mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-09 11:27:29 +00:00
Segemented config works for me (TM)
Small GPS Fix that cropped up while testing included.
This commit is contained in:
@@ -176,27 +176,27 @@ void AdminModule::handleSetConfig(const Config &c)
|
||||
switch (c.which_payloadVariant) {
|
||||
case Config_device_tag:
|
||||
DEBUG_MSG("Setting config: Device\n");
|
||||
config.payloadVariant.device = c.payloadVariant.device;
|
||||
config.device = c.payloadVariant.device;
|
||||
break;
|
||||
case Config_position_tag:
|
||||
DEBUG_MSG("Setting config: Position\n");
|
||||
config.payloadVariant.position = c.payloadVariant.position;
|
||||
config.position = c.payloadVariant.position;
|
||||
break;
|
||||
case Config_power_tag:
|
||||
DEBUG_MSG("Setting config: Power\n");
|
||||
config.payloadVariant.power = c.payloadVariant.power;
|
||||
config.power = c.payloadVariant.power;
|
||||
break;
|
||||
case Config_wifi_tag:
|
||||
DEBUG_MSG("Setting config: WiFi\n");
|
||||
config.payloadVariant.wifi = c.payloadVariant.wifi;
|
||||
config.wifi = c.payloadVariant.wifi;
|
||||
break;
|
||||
case Config_display_tag:
|
||||
DEBUG_MSG("Setting config: Display\n");
|
||||
config.payloadVariant.display = c.payloadVariant.display;
|
||||
config.display = c.payloadVariant.display;
|
||||
break;
|
||||
case Config_lora_tag:
|
||||
DEBUG_MSG("Setting config: LoRa\n");
|
||||
config.payloadVariant.lora = c.payloadVariant.lora;
|
||||
config.lora = c.payloadVariant.lora;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -271,33 +271,33 @@ void AdminModule::handleGetConfig(const MeshPacket &req, const uint32_t configTy
|
||||
case AdminMessage_ConfigType_DEVICE_CONFIG:
|
||||
DEBUG_MSG("Getting config: Device\n");
|
||||
res.get_config_response.which_payloadVariant = Config_device_tag;
|
||||
res.get_config_response.payloadVariant.device = config.payloadVariant.device;
|
||||
res.get_config_response.payloadVariant.device = config.device;
|
||||
break;
|
||||
case AdminMessage_ConfigType_POSITION_CONFIG:
|
||||
DEBUG_MSG("Getting config: Position\n");
|
||||
res.get_config_response.which_payloadVariant = Config_position_tag;
|
||||
res.get_config_response.payloadVariant.position = config.payloadVariant.position;
|
||||
res.get_config_response.payloadVariant.position = config.position;
|
||||
break;
|
||||
case AdminMessage_ConfigType_POWER_CONFIG:
|
||||
DEBUG_MSG("Getting config: Power\n");
|
||||
res.get_config_response.which_payloadVariant = Config_power_tag;
|
||||
res.get_config_response.payloadVariant.power = config.payloadVariant.power;
|
||||
res.get_config_response.payloadVariant.power = config.power;
|
||||
break;
|
||||
case AdminMessage_ConfigType_WIFI_CONFIG:
|
||||
DEBUG_MSG("Getting config: WiFi\n");
|
||||
res.get_config_response.which_payloadVariant = Config_wifi_tag;
|
||||
res.get_config_response.payloadVariant.wifi = config.payloadVariant.wifi;
|
||||
writeSecret(res.get_config_response.payloadVariant.wifi.psk, config.payloadVariant.wifi.psk);
|
||||
res.get_config_response.payloadVariant.wifi = config.wifi;
|
||||
writeSecret(res.get_config_response.payloadVariant.wifi.psk, config.wifi.psk);
|
||||
break;
|
||||
case AdminMessage_ConfigType_DISPLAY_CONFIG:
|
||||
DEBUG_MSG("Getting config: Display\n");
|
||||
res.get_config_response.which_payloadVariant = Config_display_tag;
|
||||
res.get_config_response.payloadVariant.display = config.payloadVariant.display;
|
||||
res.get_config_response.payloadVariant.display = config.display;
|
||||
break;
|
||||
case AdminMessage_ConfigType_LORA_CONFIG:
|
||||
DEBUG_MSG("Getting config: LoRa\n");
|
||||
res.get_config_response.which_payloadVariant = Config_lora_tag;
|
||||
res.get_config_response.payloadVariant.lora = config.payloadVariant.lora;
|
||||
res.get_config_response.payloadVariant.lora = config.lora;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,6 @@ int32_t NodeInfoModule::runOnce()
|
||||
DEBUG_MSG("Sending our nodeinfo to mesh (wantReplies=%d)\n", requestReplies);
|
||||
sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies)
|
||||
|
||||
return config.payloadVariant.position.position_broadcast_secs ? config.payloadVariant.position.position_broadcast_secs
|
||||
return config.position.position_broadcast_secs ? config.position.position_broadcast_secs
|
||||
: default_broadcast_interval_secs * 1000;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ MeshPacket *PositionModule::allocReply()
|
||||
|
||||
// configuration of POSITION packet
|
||||
// consider making this a function argument?
|
||||
uint32_t pos_flags = config.payloadVariant.position.position_flags;
|
||||
uint32_t pos_flags = config.position.position_flags;
|
||||
|
||||
// Populate a Position struct with ONLY the requested fields
|
||||
Position p = Position_init_default; // Start with an empty structure
|
||||
@@ -127,8 +127,8 @@ int32_t PositionModule::runOnce()
|
||||
|
||||
// We limit our GPS broadcasts to a max rate
|
||||
uint32_t now = millis();
|
||||
if (lastGpsSend == 0 || now - lastGpsSend >= config.payloadVariant.position.position_broadcast_secs
|
||||
? config.payloadVariant.position.position_broadcast_secs
|
||||
if (lastGpsSend == 0 || now - lastGpsSend >= config.position.position_broadcast_secs
|
||||
? config.position.position_broadcast_secs
|
||||
: default_broadcast_interval_secs * 1000) {
|
||||
|
||||
// Only send packets if the channel is less than 40% utilized.
|
||||
@@ -151,7 +151,7 @@ int32_t PositionModule::runOnce()
|
||||
DEBUG_MSG("Channel utilization is >50 percent. Skipping this opportunity to send.\n");
|
||||
}
|
||||
|
||||
} else if (!config.payloadVariant.position.position_broadcast_smart_disabled) {
|
||||
} else if (!config.position.position_broadcast_smart_disabled) {
|
||||
|
||||
// Only send packets if the channel is less than 25% utilized.
|
||||
if (airTime->channelUtilizationPercent() < 25) {
|
||||
|
||||
@@ -71,7 +71,7 @@ int32_t RangeTestModule::runOnce()
|
||||
DEBUG_MSG("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock());
|
||||
DEBUG_MSG("gpsStatus->getDOP() %d\n", gpsStatus->getDOP());
|
||||
DEBUG_MSG("gpsStatus->getHasLock() %d\n", gpsStatus->getHasLock());
|
||||
DEBUG_MSG("pref.fixed_position() %d\n", config.payloadVariant.position.fixed_position);
|
||||
DEBUG_MSG("pref.fixed_position() %d\n", config.position.fixed_position);
|
||||
|
||||
// Only send packets if the channel is less than 25% utilized.
|
||||
if (airTime->channelUtilizationPercent() < 25) {
|
||||
|
||||
@@ -21,7 +21,7 @@ int32_t StoreForwardModule::runOnce()
|
||||
|
||||
if (moduleConfig.payloadVariant.store_forward.enabled) {
|
||||
|
||||
if (config.payloadVariant.device.role == Config_DeviceConfig_Role_Router) {
|
||||
if (config.device.role == Config_DeviceConfig_Role_Router) {
|
||||
|
||||
// Send out the message queue.
|
||||
if (this->busy) {
|
||||
@@ -392,13 +392,13 @@ StoreForwardModule::StoreForwardModule()
|
||||
*/
|
||||
|
||||
moduleConfig.payloadVariant.store_forward.enabled = 1;
|
||||
config.payloadVariant.power.is_always_powered = 1;
|
||||
config.power.is_always_powered = 1;
|
||||
}
|
||||
|
||||
if (moduleConfig.payloadVariant.store_forward.enabled) {
|
||||
|
||||
// Router
|
||||
if (config.payloadVariant.device.role == Config_DeviceConfig_Role_Router) {
|
||||
if (config.device.role == Config_DeviceConfig_Role_Router) {
|
||||
DEBUG_MSG("Initializing Store & Forward Module - Enabled as Router\n");
|
||||
if (ESP.getPsramSize()) {
|
||||
if (ESP.getFreePsram() >= 1024 * 1024) {
|
||||
|
||||
Reference in New Issue
Block a user