Skip to content

Commit 1ac2382

Browse files
committed
Revert "Fix excluded modules configuration handling (#7838)"
This reverts commit 9c6544e.
1 parent 2ef5b96 commit 1ac2382

File tree

6 files changed

+2
-114
lines changed

6 files changed

+2
-114
lines changed

src/configuration.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
438438
#define MESHTASTIC_EXCLUDE_SERIAL 1
439439
#define MESHTASTIC_EXCLUDE_POWERSTRESS 1
440440
#define MESHTASTIC_EXCLUDE_ADMIN 1
441-
#define MESHTASTIC_EXCLUDE_AMBIENTLIGHTING 1
442441
#endif
443442

444443
// // Turn off wifi even if HW supports wifi (webserver relies on wifi and is also disabled)

src/main.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,9 +1513,6 @@ extern meshtastic_DeviceMetadata getDeviceMetadata()
15131513
deviceMetadata.hw_model = HW_VENDOR;
15141514
deviceMetadata.hasRemoteHardware = moduleConfig.remote_hardware.enabled;
15151515
deviceMetadata.excluded_modules = meshtastic_ExcludedModules_EXCLUDED_NONE;
1516-
#if MESHTASTIC_EXCLUDE_MQTT
1517-
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_MQTT_CONFIG;
1518-
#endif
15191516
#if MESHTASTIC_EXCLUDE_REMOTEHARDWARE
15201517
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_REMOTEHARDWARE_CONFIG;
15211518
#endif
@@ -1538,21 +1535,10 @@ extern meshtastic_DeviceMetadata getDeviceMetadata()
15381535
#if NO_EXT_GPIO && NO_GPS || MESHTASTIC_EXCLUDE_SERIAL
15391536
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_SERIAL_CONFIG;
15401537
#endif
1541-
#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_PAXCOUNTER
1542-
// PAXCOUNTER is only supported on ESP32 due to memory constraints
1543-
#else
1538+
#ifndef ARCH_ESP32
15441539
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_PAXCOUNTER_CONFIG;
15451540
#endif
1546-
#if MESHTASTIC_EXCLUDE_STOREFORWARD
1547-
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_STOREFORWARD_CONFIG;
1548-
#endif
1549-
#if MESHTASTIC_EXCLUDE_RANGETEST
1550-
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_RANGETEST_CONFIG;
1551-
#endif
1552-
#if MESHTASTIC_EXCLUDE_NEIGHBORINFO
1553-
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_NEIGHBORINFO_CONFIG;
1554-
#endif
1555-
#if (!defined(HAS_RGB_LED) && !defined(RAK_4631)) || defined(MESHTASTIC_EXCLUDE_AMBIENTLIGHTING)
1541+
#if !defined(HAS_RGB_LED) && !RAK_4631
15561542
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_AMBIENTLIGHTING_CONFIG;
15571543
#endif
15581544

src/mesh/NodeDB.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -775,9 +775,7 @@ void NodeDB::installDefaultModuleConfig()
775775

776776
moduleConfig.version = DEVICESTATE_CUR_VER;
777777
moduleConfig.has_mqtt = true;
778-
#if !MESHTASTIC_EXCLUDE_RANGETEST
779778
moduleConfig.has_range_test = true;
780-
#endif
781779
moduleConfig.has_serial = true;
782780
moduleConfig.has_store_forward = true;
783781
moduleConfig.has_telemetry = true;
@@ -843,12 +841,6 @@ void NodeDB::installDefaultModuleConfig()
843841
moduleConfig.canned_message.inputbroker_event_press = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
844842
#endif
845843
moduleConfig.has_canned_message = true;
846-
#if !MESHTASTIC_EXCLUDE_AUDIO
847-
moduleConfig.has_audio = true;
848-
#endif
849-
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
850-
moduleConfig.has_paxcounter = true;
851-
#endif
852844
#if USERPREFS_MQTT_ENABLED && !MESHTASTIC_EXCLUDE_MQTT
853845
moduleConfig.mqtt.enabled = true;
854846
#endif
@@ -891,14 +883,12 @@ void NodeDB::installDefaultModuleConfig()
891883
moduleConfig.detection_sensor.detection_trigger_type = meshtastic_ModuleConfig_DetectionSensorConfig_TriggerType_LOGIC_HIGH;
892884
moduleConfig.detection_sensor.minimum_broadcast_secs = 45;
893885

894-
#if !MESHTASTIC_EXCLUDE_AMBIENTLIGHTING
895886
moduleConfig.has_ambient_lighting = true;
896887
moduleConfig.ambient_lighting.current = 10;
897888
// Default to a color based on our node number
898889
moduleConfig.ambient_lighting.red = (myNodeInfo.my_node_num & 0xFF0000) >> 16;
899890
moduleConfig.ambient_lighting.green = (myNodeInfo.my_node_num & 0x00FF00) >> 8;
900891
moduleConfig.ambient_lighting.blue = myNodeInfo.my_node_num & 0x0000FF;
901-
#endif
902892

903893
initModuleConfigIntervals();
904894
}
@@ -1438,25 +1428,15 @@ bool NodeDB::saveToDiskNoRetry(int saveWhat)
14381428
moduleConfig.has_canned_message = true;
14391429
moduleConfig.has_external_notification = true;
14401430
moduleConfig.has_mqtt = true;
1441-
#if !MESHTASTIC_EXCLUDE_RANGETEST
14421431
moduleConfig.has_range_test = true;
1443-
#endif
14441432
moduleConfig.has_serial = true;
1445-
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
14461433
moduleConfig.has_store_forward = true;
1447-
#endif
14481434
moduleConfig.has_telemetry = true;
14491435
moduleConfig.has_neighbor_info = true;
14501436
moduleConfig.has_detection_sensor = true;
1451-
#if !MESHTASTIC_EXCLUDE_AMBIENTLIGHTING
14521437
moduleConfig.has_ambient_lighting = true;
1453-
#endif
1454-
#if !MESHTASTIC_EXCLUDE_AUDIO
14551438
moduleConfig.has_audio = true;
1456-
#endif
1457-
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
14581439
moduleConfig.has_paxcounter = true;
1459-
#endif
14601440

14611441
success &=
14621442
saveProto(moduleConfigFileName, meshtastic_LocalModuleConfig_size, &meshtastic_LocalModuleConfig_msg, &moduleConfig);

src/mesh/PhoneAPI.cpp

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,6 @@
3434
// Flag to indicate a heartbeat was received and we should send queue status
3535
bool heartbeatReceived = false;
3636

37-
// Helper function to skip excluded module configs and advance state
38-
size_t PhoneAPI::skipExcludedModuleConfig(uint8_t *buf)
39-
{
40-
config_state++;
41-
if (config_state > (_meshtastic_AdminMessage_ModuleConfigType_MAX + 1)) {
42-
if (config_nonce == SPECIAL_NONCE_ONLY_CONFIG) {
43-
state = STATE_SEND_FILEMANIFEST;
44-
} else {
45-
state = STATE_SEND_OTHER_NODEINFOS;
46-
}
47-
config_state = 0;
48-
}
49-
return getFromRadio(buf);
50-
}
51-
5237
PhoneAPI::PhoneAPI()
5338
{
5439
lastContactMsec = millis();
@@ -370,35 +355,20 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
370355
fromRadioScratch.moduleConfig.payload_variant.serial = moduleConfig.serial;
371356
break;
372357
case meshtastic_ModuleConfig_external_notification_tag:
373-
#if !(NO_EXT_GPIO || MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION)
374358
LOG_DEBUG("Send module config: ext notification");
375359
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_external_notification_tag;
376360
fromRadioScratch.moduleConfig.payload_variant.external_notification = moduleConfig.external_notification;
377361
break;
378-
#else
379-
LOG_DEBUG("External Notification module excluded from build, skipping");
380-
return skipExcludedModuleConfig(buf);
381-
#endif
382362
case meshtastic_ModuleConfig_store_forward_tag:
383-
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
384363
LOG_DEBUG("Send module config: store forward");
385364
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_store_forward_tag;
386365
fromRadioScratch.moduleConfig.payload_variant.store_forward = moduleConfig.store_forward;
387366
break;
388-
#else
389-
LOG_DEBUG("Store & Forward module excluded from build, skipping");
390-
return skipExcludedModuleConfig(buf);
391-
#endif
392367
case meshtastic_ModuleConfig_range_test_tag:
393-
#if !MESHTASTIC_EXCLUDE_RANGETEST
394368
LOG_DEBUG("Send module config: range test");
395369
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_range_test_tag;
396370
fromRadioScratch.moduleConfig.payload_variant.range_test = moduleConfig.range_test;
397371
break;
398-
#else
399-
LOG_DEBUG("Range Test module excluded from build, skipping");
400-
return skipExcludedModuleConfig(buf);
401-
#endif
402372
case meshtastic_ModuleConfig_telemetry_tag:
403373
LOG_DEBUG("Send module config: telemetry");
404374
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_telemetry_tag;
@@ -410,15 +380,10 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
410380
fromRadioScratch.moduleConfig.payload_variant.canned_message = moduleConfig.canned_message;
411381
break;
412382
case meshtastic_ModuleConfig_audio_tag:
413-
#if !MESHTASTIC_EXCLUDE_AUDIO
414383
LOG_DEBUG("Send module config: audio");
415384
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_audio_tag;
416385
fromRadioScratch.moduleConfig.payload_variant.audio = moduleConfig.audio;
417386
break;
418-
#else
419-
LOG_DEBUG("Audio module excluded from build, skipping");
420-
return skipExcludedModuleConfig(buf);
421-
#endif
422387
case meshtastic_ModuleConfig_remote_hardware_tag:
423388
LOG_DEBUG("Send module config: remote hardware");
424389
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_remote_hardware_tag;
@@ -435,25 +400,15 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
435400
fromRadioScratch.moduleConfig.payload_variant.detection_sensor = moduleConfig.detection_sensor;
436401
break;
437402
case meshtastic_ModuleConfig_ambient_lighting_tag:
438-
#if !MESHTASTIC_EXCLUDE_AMBIENTLIGHTING
439403
LOG_DEBUG("Send module config: ambient lighting");
440404
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_ambient_lighting_tag;
441405
fromRadioScratch.moduleConfig.payload_variant.ambient_lighting = moduleConfig.ambient_lighting;
442406
break;
443-
#else
444-
LOG_DEBUG("Ambient Lighting module excluded from build, skipping");
445-
return skipExcludedModuleConfig(buf);
446-
#endif
447407
case meshtastic_ModuleConfig_paxcounter_tag:
448-
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
449408
LOG_DEBUG("Send module config: paxcounter");
450409
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_paxcounter_tag;
451410
fromRadioScratch.moduleConfig.payload_variant.paxcounter = moduleConfig.paxcounter;
452411
break;
453-
#else
454-
LOG_DEBUG("Paxcounter module excluded from build, skipping");
455-
return skipExcludedModuleConfig(buf);
456-
#endif
457412
default:
458413
LOG_ERROR("Unknown module config type %d", config_state);
459414
}

src/mesh/PhoneAPI.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,4 @@ class PhoneAPI
172172

173173
/// If the mesh service tells us fromNum has changed, tell the phone
174174
virtual int onNotify(uint32_t newValue) override;
175-
176-
/// Helper function to skip excluded module configs and advance state
177-
size_t skipExcludedModuleConfig(uint8_t *buf);
178175
};

src/modules/AdminModule.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,32 +1044,19 @@ void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const
10441044
res.get_module_config_response.payload_variant.serial = moduleConfig.serial;
10451045
break;
10461046
case meshtastic_AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG:
1047-
#if !MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION
10481047
LOG_INFO("Get module config: External Notification");
10491048
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_external_notification_tag;
10501049
res.get_module_config_response.payload_variant.external_notification = moduleConfig.external_notification;
1051-
#else
1052-
LOG_DEBUG("External Notification module excluded from build, skipping config");
1053-
#endif
10541050
break;
10551051
case meshtastic_AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG:
1056-
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
10571052
LOG_INFO("Get module config: Store & Forward");
10581053
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_store_forward_tag;
10591054
res.get_module_config_response.payload_variant.store_forward = moduleConfig.store_forward;
1060-
#else
1061-
LOG_DEBUG("Store & Forward module excluded from build, skipping config");
1062-
#endif
10631055
break;
10641056
case meshtastic_AdminMessage_ModuleConfigType_RANGETEST_CONFIG:
1065-
#if !MESHTASTIC_EXCLUDE_RANGETEST
10661057
LOG_INFO("Get module config: Range Test");
10671058
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_range_test_tag;
10681059
res.get_module_config_response.payload_variant.range_test = moduleConfig.range_test;
1069-
#else
1070-
LOG_DEBUG("Range Test module excluded from build, skipping config");
1071-
// Don't set payload variant - will result in empty response
1072-
#endif
10731060
break;
10741061
case meshtastic_AdminMessage_ModuleConfigType_TELEMETRY_CONFIG:
10751062
LOG_INFO("Get module config: Telemetry");
@@ -1082,13 +1069,9 @@ void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const
10821069
res.get_module_config_response.payload_variant.canned_message = moduleConfig.canned_message;
10831070
break;
10841071
case meshtastic_AdminMessage_ModuleConfigType_AUDIO_CONFIG:
1085-
#if !MESHTASTIC_EXCLUDE_AUDIO
10861072
LOG_INFO("Get module config: Audio");
10871073
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_audio_tag;
10881074
res.get_module_config_response.payload_variant.audio = moduleConfig.audio;
1089-
#else
1090-
LOG_DEBUG("Audio module excluded from build, skipping config");
1091-
#endif
10921075
break;
10931076
case meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG:
10941077
LOG_INFO("Get module config: Remote Hardware");
@@ -1101,31 +1084,19 @@ void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const
11011084
res.get_module_config_response.payload_variant.neighbor_info = moduleConfig.neighbor_info;
11021085
break;
11031086
case meshtastic_AdminMessage_ModuleConfigType_DETECTIONSENSOR_CONFIG:
1104-
#if !(NO_EXT_GPIO || MESHTASTIC_EXCLUDE_DETECTIONSENSOR)
11051087
LOG_INFO("Get module config: Detection Sensor");
11061088
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_detection_sensor_tag;
11071089
res.get_module_config_response.payload_variant.detection_sensor = moduleConfig.detection_sensor;
1108-
#else
1109-
LOG_DEBUG("Detection Sensor module excluded from build, skipping config");
1110-
#endif
11111090
break;
11121091
case meshtastic_AdminMessage_ModuleConfigType_AMBIENTLIGHTING_CONFIG:
1113-
#if !MESHTASTIC_EXCLUDE_AMBIENTLIGHTING
11141092
LOG_INFO("Get module config: Ambient Lighting");
11151093
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_ambient_lighting_tag;
11161094
res.get_module_config_response.payload_variant.ambient_lighting = moduleConfig.ambient_lighting;
1117-
#else
1118-
LOG_DEBUG("Ambient Lighting module excluded from build, skipping config");
1119-
#endif
11201095
break;
11211096
case meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG:
1122-
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
11231097
LOG_INFO("Get module config: Paxcounter");
11241098
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_paxcounter_tag;
11251099
res.get_module_config_response.payload_variant.paxcounter = moduleConfig.paxcounter;
1126-
#else
1127-
LOG_DEBUG("Paxcounter module excluded from build, skipping config");
1128-
#endif
11291100
break;
11301101
}
11311102

0 commit comments

Comments
 (0)