mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-26 18:09:04 +00:00
Make region changes take effect immedately
This commit is contained in:
parent
f698883c02
commit
cfcb62bd18
@ -198,7 +198,10 @@ void MeshService::loop()
|
|||||||
bool MeshService::reloadConfig()
|
bool MeshService::reloadConfig()
|
||||||
{
|
{
|
||||||
// If we can successfully set this radio to these settings, save them to disk
|
// 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
|
bool didReset = nodeDB.resetRadioConfig(); // Don't let the phone send us fatally bad settings
|
||||||
|
|
||||||
configChanged.notifyObservers(NULL);
|
configChanged.notifyObservers(NULL);
|
||||||
nodeDB.saveToDisk();
|
nodeDB.saveToDisk();
|
||||||
|
|
||||||
|
@ -150,6 +150,9 @@ bool NodeDB::resetRadioConfig()
|
|||||||
radioConfig.preferences.region = RegionCode_TW;
|
radioConfig.preferences.region = RegionCode_TW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the global myRegion
|
||||||
|
initRegion();
|
||||||
|
|
||||||
return didFactoryReset;
|
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.firmware_version, optstr(APP_VERSION), sizeof(myNodeInfo.firmware_version));
|
||||||
strncpy(myNodeInfo.hw_model, HW_VENDOR, sizeof(myNodeInfo.hw_model));
|
strncpy(myNodeInfo.hw_model, HW_VENDOR, sizeof(myNodeInfo.hw_model));
|
||||||
|
|
||||||
|
@ -30,15 +30,13 @@ const RegionInfo *myRegion;
|
|||||||
|
|
||||||
void initRegion()
|
void initRegion()
|
||||||
{
|
{
|
||||||
if (!myRegion) {
|
const RegionInfo *r = regions;
|
||||||
const RegionInfo *r = regions;
|
for (; r->code != RegionCode_Unset && r->code != radioConfig.preferences.region; r++)
|
||||||
for (; r->code != RegionCode_Unset && r->code != radioConfig.preferences.region; r++)
|
;
|
||||||
;
|
myRegion = r;
|
||||||
myRegion = r;
|
DEBUG_MSG("Wanted region %d, using %s\n", radioConfig.preferences.region, r->name);
|
||||||
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
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user