sforkowany z mirror/meshtastic-firmware
Make region changes take effect immedately
rodzic
f698883c02
commit
cfcb62bd18
|
@ -198,7 +198,10 @@ void MeshService::loop()
|
|||
bool MeshService::reloadConfig()
|
||||
{
|
||||
// If we can successfully set this radio to these settings, save them to disk
|
||||
|
||||
// This will also update the region as needed
|
||||
bool didReset = nodeDB.resetRadioConfig(); // Don't let the phone send us fatally bad settings
|
||||
|
||||
configChanged.notifyObservers(NULL);
|
||||
nodeDB.saveToDisk();
|
||||
|
||||
|
|
|
@ -150,6 +150,9 @@ bool NodeDB::resetRadioConfig()
|
|||
radioConfig.preferences.region = RegionCode_TW;
|
||||
}
|
||||
|
||||
// Update the global myRegion
|
||||
initRegion();
|
||||
|
||||
return didFactoryReset;
|
||||
}
|
||||
|
||||
|
@ -245,9 +248,6 @@ void NodeDB::init()
|
|||
}
|
||||
}
|
||||
|
||||
// Update the global myRegion
|
||||
initRegion();
|
||||
|
||||
strncpy(myNodeInfo.firmware_version, optstr(APP_VERSION), sizeof(myNodeInfo.firmware_version));
|
||||
strncpy(myNodeInfo.hw_model, HW_VENDOR, sizeof(myNodeInfo.hw_model));
|
||||
|
||||
|
|
|
@ -30,15 +30,13 @@ const RegionInfo *myRegion;
|
|||
|
||||
void initRegion()
|
||||
{
|
||||
if (!myRegion) {
|
||||
const RegionInfo *r = regions;
|
||||
for (; r->code != RegionCode_Unset && r->code != radioConfig.preferences.region; r++)
|
||||
;
|
||||
myRegion = r;
|
||||
DEBUG_MSG("Wanted region %d, using %s\n", radioConfig.preferences.region, r->name);
|
||||
const RegionInfo *r = regions;
|
||||
for (; r->code != RegionCode_Unset && r->code != radioConfig.preferences.region; r++)
|
||||
;
|
||||
myRegion = r;
|
||||
DEBUG_MSG("Wanted region %d, using %s\n", radioConfig.preferences.region, r->name);
|
||||
|
||||
myNodeInfo.num_channels = myRegion->numChannels; // Tell our android app how many channels we have
|
||||
}
|
||||
myNodeInfo.num_channels = myRegion->numChannels; // Tell our android app how many channels we have
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Ładowanie…
Reference in New Issue