Split MQTT and ESP-NOW controls in Full ESP32 builds

This commit is contained in:
mikecarper committed 2026-09-17 01:13:10 -07:00
1 parent 9a149eaea1
commit 30067cb5cd
14 files changed
+337 -108

No files matched your search

+3
View File
@@ -48,6 +48,7 @@ def full_command_keys(text):
COMMON_QUERY_EXCEPTIONS = {
'bootloader.ver': 'Installed bootloader identity',
'bridge.running': 'Live bridge state; set bridge.enabled controls intent',
'espnow.running': 'Live ESP-NOW bridge state; set espnow.enabled controls intent',
'bridge.type': 'Build-selected bridge transport',
'password': 'Written by the password command, not set password',
'public.key': 'Derived from identity; written through set prv.key',
@@ -80,6 +81,8 @@ class CLISettingsContractTest(unittest.TestCase):
'esp32_web': ['ESP_PLATFORM', 'ESP32_PLATFORM', 'ADMIN_PASSWORD', 'MESH_USB_LOGGING_AVAILABLE'],
'esp32_mqtt': ['ESP_PLATFORM', 'ESP32_PLATFORM', 'WITH_MQTT_BRIDGE', 'WITH_BRIDGE',
'WITH_MQTT_NEIGHBORS', 'MESH_USB_LOGGING_AVAILABLE'],
'esp32_mqtt_espnow': ['ESP_PLATFORM', 'ESP32_PLATFORM', 'WITH_MQTT_BRIDGE',
'WITH_ESPNOW_BRIDGE', 'WITH_BRIDGE'],
'rs232_gps': ['WITH_BRIDGE', 'WITH_RS232_BRIDGE', 'ENV_INCLUDE_GPS'],
'espnow': ['ESP_PLATFORM', 'ESP32_PLATFORM', 'WITH_BRIDGE', 'WITH_ESPNOW_BRIDGE', 'MESH_PRIMARY_ESPNOW'],
'lr2021': ['USE_LR2021'],
+19
View File
@@ -113,6 +113,25 @@ int main(){
'''
class EspNowLifecycleTests(unittest.TestCase):
def test_combined_full_transport_controls_are_independent(self):
common = (ROOT/'src/helpers/CommonCLI.cpp').read_text()
observer = (ROOT/'src/helpers/CommonCLI_Observer.cpp').read_text()
prefs = (ROOT/'src/helpers/CommonCLI.h').read_text()
self.assertIn('uint8_t espnow_bridge_enabled = 1;', prefs)
self.assertIn('setEspNowBridgeState(enable)', common)
self.assertIn('_prefs->espnow_bridge_enabled', common)
self.assertIn('setMqttBridgeState(enable)', observer)
self.assertIn('isMqttBridgeRunning()', observer)
for role in ('simple_repeater', 'simple_room_server'):
header = (ROOT/f'examples/{role}/MyMesh.h').read_text()
combined = method(header, 'bool setBridgeState(bool enable) override')
self.assertIn('setMqttBridgeState(true)', combined)
self.assertIn('setEspNowBridgeState(true)', combined)
mqtt = method(header, 'bool setMqttBridgeState(bool enable) override')
espnow = method(header, 'bool setEspNowBridgeState(bool enable) override')
self.assertIn('if (espnow_bridge.isRunning()) espnow_bridge.end();', mqtt)
self.assertIn('if (mqtt_bridge' if role == 'simple_repeater' else 'if (bridge', espnow)
def test_sdk_failures_stop_and_restart(self):
header=(ROOT/'src/helpers/esp32/ESPNOWRadio.h').read_text()
source=(ROOT/'src/helpers/esp32/ESPNOWRadio.cpp').read_text()
+3 -2
View File
@@ -1012,9 +1012,10 @@ const combinedObserver = combinedCatalog.profiles.find(profile => profile.target
assert.deepStrictEqual(picker.profileFieldValues(combinedObserver, 'mode'), ['standard', 'espnow']);
assert(picker.profileMatches(combinedObserver, {mode: 'espnow'}, ['mode']));
const combinedDirections = picker.runtimeDirections(combinedObserver, {logging: 'usb'});
assert(combinedDirections.some(section => section.title === 'MQTT + ESP-NOW bridge'));
assert(!combinedDirections.some(section => section.title === 'ESP-NOW bridge'));
assert(combinedDirections.some(section => section.title === 'MQTT broker connections'));
assert(combinedDirections.some(section => section.title === 'ESP-NOW bridge'));
assert.strictEqual(commands(combinedDirections).filter(command => command === 'set mqtt.enabled on').length, 1);
assert.strictEqual(commands(combinedDirections).filter(command => command === 'set bridge.enabled on').length, 1);
console.log('current release metadata and capacity directions tests passed');
assert.strictEqual(nrf.chipFamily, 'nrf52');
+4
View File
@@ -338,6 +338,10 @@ struct {
bool hasWirelessNetworkClient(){return network;}
bool isBridgeRunning(){return bridge;}
bool setBridgeState(bool on){bridge=on;return true;}
bool isMqttBridgeRunning(){return bridge;}
bool isEspNowBridgeRunning(){return bridge;}
bool setMqttBridgeState(bool on){bridge=on;return true;}
bool setEspNowBridgeState(bool on){bridge=on;return true;}
bool stopWebConfig(char*){web=false;stopping=true;return true;}
bool startWebConfig(bool,char*){web=true;return true;}
} the_mesh;