Skip to content

Commit

Permalink
Merge branch 'master' into rp2040-slowclock
Browse files Browse the repository at this point in the history
  • Loading branch information
thebentern authored Mar 15, 2024
2 parents e8bb14d + ec6bdee commit f951c85
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/PowerFSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,10 @@ void PowerFSM_setup()
// Don't add power saving transitions if we are a power saving tracker or sensor. Sleep will be initiatiated through the
// modules
if ((isRouter || config.power.is_power_saving) && !isTrackerOrSensor) {
powerFSM.add_timed_transition(&stateNB, isInfrastructureRole ? &stateSDS : &stateLS,
powerFSM.add_timed_transition(&stateNB, &stateLS,
getConfiguredOrDefaultMs(config.power.min_wake_secs, default_min_wake_secs), NULL,
"Min wake timeout");
powerFSM.add_timed_transition(&stateDARK, isInfrastructureRole ? &stateSDS : &stateLS,
powerFSM.add_timed_transition(&stateDARK, &stateLS,
getConfiguredOrDefaultMs(config.power.wait_bluetooth_secs, default_wait_bluetooth_secs),
NULL, "Bluetooth timeout");
}
Expand Down
13 changes: 2 additions & 11 deletions src/mesh/NodeDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,7 @@ bool NodeDB::resetRadioConfig(bool factory_reset)
// devicestate.no_save = true;
if (devicestate.no_save) {
LOG_DEBUG("***** DEVELOPMENT MODE - DO NOT RELEASE *****\n");

// Sleep quite frequently to stress test the BLE comms, broadcast position every 6 mins
config.display.screen_on_secs = 10;
config.power.wait_bluetooth_secs = 10;
config.position.position_broadcast_secs = 6 * 60;
config.power.ls_secs = 60;
config.lora.region = meshtastic_Config_LoRaConfig_RegionCode_TW;

// Enter super deep sleep soon and stay there not very long
// radioConfig.preferences.sds_secs = 60;
// Put your development config changes here
}

// Update the global myRegion
Expand Down Expand Up @@ -199,7 +190,7 @@ void NodeDB::installDefaultConfig()
config.position.broadcast_smart_minimum_distance = 100;
config.position.broadcast_smart_minimum_interval_secs = 30;
if (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER)
config.device.node_info_broadcast_secs = 3 * 60 * 60;
config.device.node_info_broadcast_secs = default_node_info_broadcast_secs;
config.device.serial_enabled = true;
resetRadioConfig();
strncpy(config.network.ntp_server, "0.pool.ntp.org", 32);
Expand Down
2 changes: 2 additions & 0 deletions src/mesh/NodeDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ extern NodeDB nodeDB;
#define default_ls_secs IF_ROUTER(ONE_DAY, 5 * 60)
#define default_min_wake_secs 10
#define default_screen_on_secs IF_ROUTER(1, 60 * 10)
#define default_node_info_broadcast_secs 3 * 60 * 60
#define min_node_info_broadcast_secs 60 * 60 // No regular broadcasts of more than once an hour

#define default_mqtt_address "mqtt.meshtastic.org"
#define default_mqtt_username "meshdev"
Expand Down
4 changes: 4 additions & 0 deletions src/modules/AdminModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
// If we're setting router role for the first time, install its intervals
if (existingRole != c.payload_variant.device.role)
nodeDB.installRoleDefaults(c.payload_variant.device.role);
if (config.device.node_info_broadcast_secs < min_node_info_broadcast_secs) {
LOG_DEBUG("Tried to set node_info_broadcast_secs too low, setting to %d\n", min_node_info_broadcast_secs);
config.device.node_info_broadcast_secs = min_node_info_broadcast_secs;
}
break;
case meshtastic_Config_position_tag:
LOG_INFO("Setting config: Position\n");
Expand Down
3 changes: 1 addition & 2 deletions src/modules/NodeInfoModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,5 @@ int32_t NodeInfoModule::runOnce()
LOG_INFO("Sending our nodeinfo to mesh (wantReplies=%d)\n", requestReplies);
sendOurNodeInfo(NODENUM_BROADCAST, requestReplies); // Send our info (don't request replies)
}

return getConfiguredOrDefaultMs(config.device.node_info_broadcast_secs, default_broadcast_interval_secs);
return getConfiguredOrDefaultMs(config.device.node_info_broadcast_secs, default_node_info_broadcast_secs);
}

0 comments on commit f951c85

Please sign in to comment.