sforkowany z mirror/meshtastic-firmware
Merge branch 'master' into create-pull-request/patch
commit
03affc9e73
|
@ -146,6 +146,13 @@ bool NodeDB::resetRadioConfig()
|
||||||
void NodeDB::installDefaultConfig()
|
void NodeDB::installDefaultConfig()
|
||||||
{
|
{
|
||||||
memset(&config, 0, sizeof(LocalConfig));
|
memset(&config, 0, sizeof(LocalConfig));
|
||||||
|
config.has_device = true;
|
||||||
|
config.has_display = true;
|
||||||
|
config.has_lora = true;
|
||||||
|
config.has_position = true;
|
||||||
|
config.has_power = true;
|
||||||
|
config.has_wifi = true;
|
||||||
|
|
||||||
config.lora.region = Config_LoRaConfig_RegionCode_Unset;
|
config.lora.region = Config_LoRaConfig_RegionCode_Unset;
|
||||||
config.lora.modem_preset = Config_LoRaConfig_ModemPreset_LongFast;
|
config.lora.modem_preset = Config_LoRaConfig_ModemPreset_LongFast;
|
||||||
resetRadioConfig();
|
resetRadioConfig();
|
||||||
|
@ -158,6 +165,13 @@ void NodeDB::installDefaultConfig()
|
||||||
void NodeDB::installDefaultModuleConfig()
|
void NodeDB::installDefaultModuleConfig()
|
||||||
{
|
{
|
||||||
memset(&moduleConfig, 0, sizeof(ModuleConfig));
|
memset(&moduleConfig, 0, sizeof(ModuleConfig));
|
||||||
|
moduleConfig.has_canned_message = true;
|
||||||
|
moduleConfig.has_external_notification = true;
|
||||||
|
moduleConfig.has_mqtt = true;
|
||||||
|
moduleConfig.has_range_test = true;
|
||||||
|
moduleConfig.has_serial = true;
|
||||||
|
moduleConfig.has_store_forward = true;
|
||||||
|
moduleConfig.has_telemetry = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void NodeDB::installDefaultRadioConfig()
|
// void NodeDB::installDefaultRadioConfig()
|
||||||
|
@ -341,7 +355,7 @@ void NodeDB::loadFromDisk()
|
||||||
installDefaultConfig(); // Our in RAM copy might now be corrupt
|
installDefaultConfig(); // Our in RAM copy might now be corrupt
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!loadProto(moduleConfigfile, ModuleConfig_size, sizeof(ModuleConfig), ModuleConfig_fields, &moduleConfig)) {
|
if (!loadProto(moduleConfigfile, LocalModuleConfig_size, sizeof(LocalModuleConfig), LocalModuleConfig_fields, &moduleConfig)) {
|
||||||
installDefaultModuleConfig(); // Our in RAM copy might now be corrupt
|
installDefaultModuleConfig(); // Our in RAM copy might now be corrupt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,6 +416,7 @@ void NodeDB::saveToDisk()
|
||||||
FSCom.mkdir("/prefs");
|
FSCom.mkdir("/prefs");
|
||||||
#endif
|
#endif
|
||||||
saveProto(preffile, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate);
|
saveProto(preffile, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate);
|
||||||
|
|
||||||
// save all config segments
|
// save all config segments
|
||||||
config.has_device = true;
|
config.has_device = true;
|
||||||
config.has_display = true;
|
config.has_display = true;
|
||||||
|
@ -410,7 +425,16 @@ void NodeDB::saveToDisk()
|
||||||
config.has_power = true;
|
config.has_power = true;
|
||||||
config.has_wifi = true;
|
config.has_wifi = true;
|
||||||
saveProto(configfile, LocalConfig_size, sizeof(LocalConfig), LocalConfig_fields, &config);
|
saveProto(configfile, LocalConfig_size, sizeof(LocalConfig), LocalConfig_fields, &config);
|
||||||
saveProto(moduleConfigfile, Module_Config_size, sizeof(ModuleConfig), ModuleConfig_fields, &moduleConfig);
|
|
||||||
|
moduleConfig.has_canned_message = true;
|
||||||
|
moduleConfig.has_external_notification = true;
|
||||||
|
moduleConfig.has_mqtt = true;
|
||||||
|
moduleConfig.has_range_test = true;
|
||||||
|
moduleConfig.has_serial = true;
|
||||||
|
moduleConfig.has_store_forward = true;
|
||||||
|
moduleConfig.has_telemetry = true;
|
||||||
|
saveProto(moduleConfigfile, LocalModuleConfig_size, sizeof(LocalModuleConfig), LocalModuleConfig_fields, &moduleConfig);
|
||||||
|
|
||||||
saveChannelsToDisk();
|
saveChannelsToDisk();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -216,6 +216,17 @@ bool initWifi(bool forceSoftAP)
|
||||||
DEBUG_MSG("Starting (Forced) WIFI AP: ssid=%s, ok=%d\n", softAPssid, ok);
|
DEBUG_MSG("Starting (Forced) WIFI AP: ssid=%s, ok=%d\n", softAPssid, ok);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
// If AP is configured to be hidden hidden
|
||||||
|
if (config.wifi.ap_hidden) {
|
||||||
|
|
||||||
|
// The configurations on softAP are from the espresif library
|
||||||
|
int ok = WiFi.softAP(wifiName, wifiPsw, 1, 1, 4);
|
||||||
|
DEBUG_MSG("Starting hiddem WIFI AP: ssid=%s, ok=%d\n", wifiName, ok);
|
||||||
|
} else {
|
||||||
|
int ok = WiFi.softAP(wifiName, wifiPsw);
|
||||||
|
DEBUG_MSG("Starting WIFI AP: ssid=%s, ok=%d\n", wifiName, ok);
|
||||||
|
}
|
||||||
int ok = WiFi.softAP(wifiName, wifiPsw);
|
int ok = WiFi.softAP(wifiName, wifiPsw);
|
||||||
DEBUG_MSG("Starting WIFI AP: ssid=%s, ok=%d\n", wifiName, ok);
|
DEBUG_MSG("Starting WIFI AP: ssid=%s, ok=%d\n", wifiName, ok);
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,26 +176,32 @@ void AdminModule::handleSetConfig(const Config &c)
|
||||||
switch (c.which_payloadVariant) {
|
switch (c.which_payloadVariant) {
|
||||||
case Config_device_tag:
|
case Config_device_tag:
|
||||||
DEBUG_MSG("Setting config: Device\n");
|
DEBUG_MSG("Setting config: Device\n");
|
||||||
|
config.has_device = true;
|
||||||
config.device = c.payloadVariant.device;
|
config.device = c.payloadVariant.device;
|
||||||
break;
|
break;
|
||||||
case Config_position_tag:
|
case Config_position_tag:
|
||||||
DEBUG_MSG("Setting config: Position\n");
|
DEBUG_MSG("Setting config: Position\n");
|
||||||
|
config.has_position = true;
|
||||||
config.position = c.payloadVariant.position;
|
config.position = c.payloadVariant.position;
|
||||||
break;
|
break;
|
||||||
case Config_power_tag:
|
case Config_power_tag:
|
||||||
DEBUG_MSG("Setting config: Power\n");
|
DEBUG_MSG("Setting config: Power\n");
|
||||||
|
config.has_power = true;
|
||||||
config.power = c.payloadVariant.power;
|
config.power = c.payloadVariant.power;
|
||||||
break;
|
break;
|
||||||
case Config_wifi_tag:
|
case Config_wifi_tag:
|
||||||
DEBUG_MSG("Setting config: WiFi\n");
|
DEBUG_MSG("Setting config: WiFi\n");
|
||||||
|
config.has_wifi = true;
|
||||||
config.wifi = c.payloadVariant.wifi;
|
config.wifi = c.payloadVariant.wifi;
|
||||||
break;
|
break;
|
||||||
case Config_display_tag:
|
case Config_display_tag:
|
||||||
DEBUG_MSG("Setting config: Display\n");
|
DEBUG_MSG("Setting config: Display\n");
|
||||||
|
config.has_display = true;
|
||||||
config.display = c.payloadVariant.display;
|
config.display = c.payloadVariant.display;
|
||||||
break;
|
break;
|
||||||
case Config_lora_tag:
|
case Config_lora_tag:
|
||||||
DEBUG_MSG("Setting config: LoRa\n");
|
DEBUG_MSG("Setting config: LoRa\n");
|
||||||
|
config.has_lora = true;
|
||||||
config.lora = c.payloadVariant.lora;
|
config.lora = c.payloadVariant.lora;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -208,30 +214,37 @@ void AdminModule::handleSetModuleConfig(const ModuleConfig &c)
|
||||||
switch (c.which_payloadVariant) {
|
switch (c.which_payloadVariant) {
|
||||||
case ModuleConfig_mqtt_tag:
|
case ModuleConfig_mqtt_tag:
|
||||||
DEBUG_MSG("Setting module config: MQTT\n");
|
DEBUG_MSG("Setting module config: MQTT\n");
|
||||||
|
moduleConfig.has_mqtt = true;
|
||||||
moduleConfig.mqtt = c.payloadVariant.mqtt;
|
moduleConfig.mqtt = c.payloadVariant.mqtt;
|
||||||
break;
|
break;
|
||||||
case ModuleConfig_serial_tag:
|
case ModuleConfig_serial_tag:
|
||||||
DEBUG_MSG("Setting module config: Serial\n");
|
DEBUG_MSG("Setting module config: Serial\n");
|
||||||
|
moduleConfig.has_serial = true;
|
||||||
moduleConfig.serial = c.payloadVariant.serial;
|
moduleConfig.serial = c.payloadVariant.serial;
|
||||||
break;
|
break;
|
||||||
case ModuleConfig_external_notification_tag:
|
case ModuleConfig_external_notification_tag:
|
||||||
DEBUG_MSG("Setting module config: External Notification\n");
|
DEBUG_MSG("Setting module config: External Notification\n");
|
||||||
|
moduleConfig.has_external_notification = true;
|
||||||
moduleConfig.external_notification = c.payloadVariant.external_notification;
|
moduleConfig.external_notification = c.payloadVariant.external_notification;
|
||||||
break;
|
break;
|
||||||
case ModuleConfig_store_forward_tag:
|
case ModuleConfig_store_forward_tag:
|
||||||
DEBUG_MSG("Setting module config: Store & Forward\n");
|
DEBUG_MSG("Setting module config: Store & Forward\n");
|
||||||
|
moduleConfig.has_store_forward = true;
|
||||||
moduleConfig.store_forward = c.payloadVariant.store_forward;
|
moduleConfig.store_forward = c.payloadVariant.store_forward;
|
||||||
break;
|
break;
|
||||||
case ModuleConfig_range_test_tag:
|
case ModuleConfig_range_test_tag:
|
||||||
DEBUG_MSG("Setting module config: Range Test\n");
|
DEBUG_MSG("Setting module config: Range Test\n");
|
||||||
|
moduleConfig.has_range_test = true;
|
||||||
moduleConfig.range_test = c.payloadVariant.range_test;
|
moduleConfig.range_test = c.payloadVariant.range_test;
|
||||||
break;
|
break;
|
||||||
case ModuleConfig_telemetry_tag:
|
case ModuleConfig_telemetry_tag:
|
||||||
DEBUG_MSG("Setting module config: Telemetry\n");
|
DEBUG_MSG("Setting module config: Telemetry\n");
|
||||||
|
moduleConfig.has_telemetry = true;
|
||||||
moduleConfig.telemetry = c.payloadVariant.telemetry;
|
moduleConfig.telemetry = c.payloadVariant.telemetry;
|
||||||
break;
|
break;
|
||||||
case ModuleConfig_canned_message_tag:
|
case ModuleConfig_canned_message_tag:
|
||||||
DEBUG_MSG("Setting module config: Canned Message\n");
|
DEBUG_MSG("Setting module config: Canned Message\n");
|
||||||
|
moduleConfig.has_canned_message = true;
|
||||||
moduleConfig.canned_message = c.payloadVariant.canned_message;
|
moduleConfig.canned_message = c.payloadVariant.canned_message;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue