mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-21 17:20:01 +00:00
Revert "Fix excluded modules configuration handling (#7838)"
This reverts commit 9c6544ebfa
.
This commit is contained in:
parent
2ef5b968f9
commit
1ac2382d7c
@ -438,7 +438,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define MESHTASTIC_EXCLUDE_SERIAL 1
|
||||
#define MESHTASTIC_EXCLUDE_POWERSTRESS 1
|
||||
#define MESHTASTIC_EXCLUDE_ADMIN 1
|
||||
#define MESHTASTIC_EXCLUDE_AMBIENTLIGHTING 1
|
||||
#endif
|
||||
|
||||
// // Turn off wifi even if HW supports wifi (webserver relies on wifi and is also disabled)
|
||||
|
18
src/main.cpp
18
src/main.cpp
@ -1513,9 +1513,6 @@ extern meshtastic_DeviceMetadata getDeviceMetadata()
|
||||
deviceMetadata.hw_model = HW_VENDOR;
|
||||
deviceMetadata.hasRemoteHardware = moduleConfig.remote_hardware.enabled;
|
||||
deviceMetadata.excluded_modules = meshtastic_ExcludedModules_EXCLUDED_NONE;
|
||||
#if MESHTASTIC_EXCLUDE_MQTT
|
||||
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_MQTT_CONFIG;
|
||||
#endif
|
||||
#if MESHTASTIC_EXCLUDE_REMOTEHARDWARE
|
||||
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_REMOTEHARDWARE_CONFIG;
|
||||
#endif
|
||||
@ -1538,21 +1535,10 @@ extern meshtastic_DeviceMetadata getDeviceMetadata()
|
||||
#if NO_EXT_GPIO && NO_GPS || MESHTASTIC_EXCLUDE_SERIAL
|
||||
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_SERIAL_CONFIG;
|
||||
#endif
|
||||
#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_PAXCOUNTER
|
||||
// PAXCOUNTER is only supported on ESP32 due to memory constraints
|
||||
#else
|
||||
#ifndef ARCH_ESP32
|
||||
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_PAXCOUNTER_CONFIG;
|
||||
#endif
|
||||
#if MESHTASTIC_EXCLUDE_STOREFORWARD
|
||||
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_STOREFORWARD_CONFIG;
|
||||
#endif
|
||||
#if MESHTASTIC_EXCLUDE_RANGETEST
|
||||
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_RANGETEST_CONFIG;
|
||||
#endif
|
||||
#if MESHTASTIC_EXCLUDE_NEIGHBORINFO
|
||||
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_NEIGHBORINFO_CONFIG;
|
||||
#endif
|
||||
#if (!defined(HAS_RGB_LED) && !defined(RAK_4631)) || defined(MESHTASTIC_EXCLUDE_AMBIENTLIGHTING)
|
||||
#if !defined(HAS_RGB_LED) && !RAK_4631
|
||||
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_AMBIENTLIGHTING_CONFIG;
|
||||
#endif
|
||||
|
||||
|
@ -775,9 +775,7 @@ void NodeDB::installDefaultModuleConfig()
|
||||
|
||||
moduleConfig.version = DEVICESTATE_CUR_VER;
|
||||
moduleConfig.has_mqtt = true;
|
||||
#if !MESHTASTIC_EXCLUDE_RANGETEST
|
||||
moduleConfig.has_range_test = true;
|
||||
#endif
|
||||
moduleConfig.has_serial = true;
|
||||
moduleConfig.has_store_forward = true;
|
||||
moduleConfig.has_telemetry = true;
|
||||
@ -843,12 +841,6 @@ void NodeDB::installDefaultModuleConfig()
|
||||
moduleConfig.canned_message.inputbroker_event_press = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
|
||||
#endif
|
||||
moduleConfig.has_canned_message = true;
|
||||
#if !MESHTASTIC_EXCLUDE_AUDIO
|
||||
moduleConfig.has_audio = true;
|
||||
#endif
|
||||
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
|
||||
moduleConfig.has_paxcounter = true;
|
||||
#endif
|
||||
#if USERPREFS_MQTT_ENABLED && !MESHTASTIC_EXCLUDE_MQTT
|
||||
moduleConfig.mqtt.enabled = true;
|
||||
#endif
|
||||
@ -891,14 +883,12 @@ void NodeDB::installDefaultModuleConfig()
|
||||
moduleConfig.detection_sensor.detection_trigger_type = meshtastic_ModuleConfig_DetectionSensorConfig_TriggerType_LOGIC_HIGH;
|
||||
moduleConfig.detection_sensor.minimum_broadcast_secs = 45;
|
||||
|
||||
#if !MESHTASTIC_EXCLUDE_AMBIENTLIGHTING
|
||||
moduleConfig.has_ambient_lighting = true;
|
||||
moduleConfig.ambient_lighting.current = 10;
|
||||
// Default to a color based on our node number
|
||||
moduleConfig.ambient_lighting.red = (myNodeInfo.my_node_num & 0xFF0000) >> 16;
|
||||
moduleConfig.ambient_lighting.green = (myNodeInfo.my_node_num & 0x00FF00) >> 8;
|
||||
moduleConfig.ambient_lighting.blue = myNodeInfo.my_node_num & 0x0000FF;
|
||||
#endif
|
||||
|
||||
initModuleConfigIntervals();
|
||||
}
|
||||
@ -1438,25 +1428,15 @@ bool NodeDB::saveToDiskNoRetry(int saveWhat)
|
||||
moduleConfig.has_canned_message = true;
|
||||
moduleConfig.has_external_notification = true;
|
||||
moduleConfig.has_mqtt = true;
|
||||
#if !MESHTASTIC_EXCLUDE_RANGETEST
|
||||
moduleConfig.has_range_test = true;
|
||||
#endif
|
||||
moduleConfig.has_serial = true;
|
||||
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
|
||||
moduleConfig.has_store_forward = true;
|
||||
#endif
|
||||
moduleConfig.has_telemetry = true;
|
||||
moduleConfig.has_neighbor_info = true;
|
||||
moduleConfig.has_detection_sensor = true;
|
||||
#if !MESHTASTIC_EXCLUDE_AMBIENTLIGHTING
|
||||
moduleConfig.has_ambient_lighting = true;
|
||||
#endif
|
||||
#if !MESHTASTIC_EXCLUDE_AUDIO
|
||||
moduleConfig.has_audio = true;
|
||||
#endif
|
||||
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
|
||||
moduleConfig.has_paxcounter = true;
|
||||
#endif
|
||||
|
||||
success &=
|
||||
saveProto(moduleConfigFileName, meshtastic_LocalModuleConfig_size, &meshtastic_LocalModuleConfig_msg, &moduleConfig);
|
||||
|
@ -34,21 +34,6 @@
|
||||
// Flag to indicate a heartbeat was received and we should send queue status
|
||||
bool heartbeatReceived = false;
|
||||
|
||||
// Helper function to skip excluded module configs and advance state
|
||||
size_t PhoneAPI::skipExcludedModuleConfig(uint8_t *buf)
|
||||
{
|
||||
config_state++;
|
||||
if (config_state > (_meshtastic_AdminMessage_ModuleConfigType_MAX + 1)) {
|
||||
if (config_nonce == SPECIAL_NONCE_ONLY_CONFIG) {
|
||||
state = STATE_SEND_FILEMANIFEST;
|
||||
} else {
|
||||
state = STATE_SEND_OTHER_NODEINFOS;
|
||||
}
|
||||
config_state = 0;
|
||||
}
|
||||
return getFromRadio(buf);
|
||||
}
|
||||
|
||||
PhoneAPI::PhoneAPI()
|
||||
{
|
||||
lastContactMsec = millis();
|
||||
@ -370,35 +355,20 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
fromRadioScratch.moduleConfig.payload_variant.serial = moduleConfig.serial;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_external_notification_tag:
|
||||
#if !(NO_EXT_GPIO || MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION)
|
||||
LOG_DEBUG("Send module config: ext notification");
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_external_notification_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.external_notification = moduleConfig.external_notification;
|
||||
break;
|
||||
#else
|
||||
LOG_DEBUG("External Notification module excluded from build, skipping");
|
||||
return skipExcludedModuleConfig(buf);
|
||||
#endif
|
||||
case meshtastic_ModuleConfig_store_forward_tag:
|
||||
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
|
||||
LOG_DEBUG("Send module config: store forward");
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_store_forward_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.store_forward = moduleConfig.store_forward;
|
||||
break;
|
||||
#else
|
||||
LOG_DEBUG("Store & Forward module excluded from build, skipping");
|
||||
return skipExcludedModuleConfig(buf);
|
||||
#endif
|
||||
case meshtastic_ModuleConfig_range_test_tag:
|
||||
#if !MESHTASTIC_EXCLUDE_RANGETEST
|
||||
LOG_DEBUG("Send module config: range test");
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_range_test_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.range_test = moduleConfig.range_test;
|
||||
break;
|
||||
#else
|
||||
LOG_DEBUG("Range Test module excluded from build, skipping");
|
||||
return skipExcludedModuleConfig(buf);
|
||||
#endif
|
||||
case meshtastic_ModuleConfig_telemetry_tag:
|
||||
LOG_DEBUG("Send module config: telemetry");
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_telemetry_tag;
|
||||
@ -410,15 +380,10 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
fromRadioScratch.moduleConfig.payload_variant.canned_message = moduleConfig.canned_message;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_audio_tag:
|
||||
#if !MESHTASTIC_EXCLUDE_AUDIO
|
||||
LOG_DEBUG("Send module config: audio");
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_audio_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.audio = moduleConfig.audio;
|
||||
break;
|
||||
#else
|
||||
LOG_DEBUG("Audio module excluded from build, skipping");
|
||||
return skipExcludedModuleConfig(buf);
|
||||
#endif
|
||||
case meshtastic_ModuleConfig_remote_hardware_tag:
|
||||
LOG_DEBUG("Send module config: remote hardware");
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_remote_hardware_tag;
|
||||
@ -435,25 +400,15 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
fromRadioScratch.moduleConfig.payload_variant.detection_sensor = moduleConfig.detection_sensor;
|
||||
break;
|
||||
case meshtastic_ModuleConfig_ambient_lighting_tag:
|
||||
#if !MESHTASTIC_EXCLUDE_AMBIENTLIGHTING
|
||||
LOG_DEBUG("Send module config: ambient lighting");
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_ambient_lighting_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.ambient_lighting = moduleConfig.ambient_lighting;
|
||||
break;
|
||||
#else
|
||||
LOG_DEBUG("Ambient Lighting module excluded from build, skipping");
|
||||
return skipExcludedModuleConfig(buf);
|
||||
#endif
|
||||
case meshtastic_ModuleConfig_paxcounter_tag:
|
||||
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
|
||||
LOG_DEBUG("Send module config: paxcounter");
|
||||
fromRadioScratch.moduleConfig.which_payload_variant = meshtastic_ModuleConfig_paxcounter_tag;
|
||||
fromRadioScratch.moduleConfig.payload_variant.paxcounter = moduleConfig.paxcounter;
|
||||
break;
|
||||
#else
|
||||
LOG_DEBUG("Paxcounter module excluded from build, skipping");
|
||||
return skipExcludedModuleConfig(buf);
|
||||
#endif
|
||||
default:
|
||||
LOG_ERROR("Unknown module config type %d", config_state);
|
||||
}
|
||||
|
@ -172,7 +172,4 @@ class PhoneAPI
|
||||
|
||||
/// If the mesh service tells us fromNum has changed, tell the phone
|
||||
virtual int onNotify(uint32_t newValue) override;
|
||||
|
||||
/// Helper function to skip excluded module configs and advance state
|
||||
size_t skipExcludedModuleConfig(uint8_t *buf);
|
||||
};
|
||||
|
@ -1044,32 +1044,19 @@ void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const
|
||||
res.get_module_config_response.payload_variant.serial = moduleConfig.serial;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_EXTNOTIF_CONFIG:
|
||||
#if !MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION
|
||||
LOG_INFO("Get module config: External Notification");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_external_notification_tag;
|
||||
res.get_module_config_response.payload_variant.external_notification = moduleConfig.external_notification;
|
||||
#else
|
||||
LOG_DEBUG("External Notification module excluded from build, skipping config");
|
||||
#endif
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_STOREFORWARD_CONFIG:
|
||||
#if !MESHTASTIC_EXCLUDE_STOREFORWARD
|
||||
LOG_INFO("Get module config: Store & Forward");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_store_forward_tag;
|
||||
res.get_module_config_response.payload_variant.store_forward = moduleConfig.store_forward;
|
||||
#else
|
||||
LOG_DEBUG("Store & Forward module excluded from build, skipping config");
|
||||
#endif
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_RANGETEST_CONFIG:
|
||||
#if !MESHTASTIC_EXCLUDE_RANGETEST
|
||||
LOG_INFO("Get module config: Range Test");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_range_test_tag;
|
||||
res.get_module_config_response.payload_variant.range_test = moduleConfig.range_test;
|
||||
#else
|
||||
LOG_DEBUG("Range Test module excluded from build, skipping config");
|
||||
// Don't set payload variant - will result in empty response
|
||||
#endif
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_TELEMETRY_CONFIG:
|
||||
LOG_INFO("Get module config: Telemetry");
|
||||
@ -1082,13 +1069,9 @@ void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const
|
||||
res.get_module_config_response.payload_variant.canned_message = moduleConfig.canned_message;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_AUDIO_CONFIG:
|
||||
#if !MESHTASTIC_EXCLUDE_AUDIO
|
||||
LOG_INFO("Get module config: Audio");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_audio_tag;
|
||||
res.get_module_config_response.payload_variant.audio = moduleConfig.audio;
|
||||
#else
|
||||
LOG_DEBUG("Audio module excluded from build, skipping config");
|
||||
#endif
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_REMOTEHARDWARE_CONFIG:
|
||||
LOG_INFO("Get module config: Remote Hardware");
|
||||
@ -1101,31 +1084,19 @@ void AdminModule::handleGetModuleConfig(const meshtastic_MeshPacket &req, const
|
||||
res.get_module_config_response.payload_variant.neighbor_info = moduleConfig.neighbor_info;
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_DETECTIONSENSOR_CONFIG:
|
||||
#if !(NO_EXT_GPIO || MESHTASTIC_EXCLUDE_DETECTIONSENSOR)
|
||||
LOG_INFO("Get module config: Detection Sensor");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_detection_sensor_tag;
|
||||
res.get_module_config_response.payload_variant.detection_sensor = moduleConfig.detection_sensor;
|
||||
#else
|
||||
LOG_DEBUG("Detection Sensor module excluded from build, skipping config");
|
||||
#endif
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_AMBIENTLIGHTING_CONFIG:
|
||||
#if !MESHTASTIC_EXCLUDE_AMBIENTLIGHTING
|
||||
LOG_INFO("Get module config: Ambient Lighting");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_ambient_lighting_tag;
|
||||
res.get_module_config_response.payload_variant.ambient_lighting = moduleConfig.ambient_lighting;
|
||||
#else
|
||||
LOG_DEBUG("Ambient Lighting module excluded from build, skipping config");
|
||||
#endif
|
||||
break;
|
||||
case meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG:
|
||||
#if !MESHTASTIC_EXCLUDE_PAXCOUNTER
|
||||
LOG_INFO("Get module config: Paxcounter");
|
||||
res.get_module_config_response.which_payload_variant = meshtastic_ModuleConfig_paxcounter_tag;
|
||||
res.get_module_config_response.payload_variant.paxcounter = moduleConfig.paxcounter;
|
||||
#else
|
||||
LOG_DEBUG("Paxcounter module excluded from build, skipping config");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user