sforkowany z mirror/meshtastic-firmware
Merge branch 'master' into master
commit
1efcd5e125
|
@ -1 +1 @@
|
||||||
Subproject commit 3df257bb880b0e8aff15b8022afa0848dcb85c69
|
Subproject commit c63a16c32f0a7b41fc348a8f42c9c13a024d2700
|
|
@ -379,7 +379,7 @@ float GeoCoord::latLongToMeter(double lat_a, double lng_a, double lat_b, double
|
||||||
* Latitude of the second point
|
* Latitude of the second point
|
||||||
* @param lon2
|
* @param lon2
|
||||||
* Longitude of the second point
|
* Longitude of the second point
|
||||||
* @return Bearing between the two points in radians. A value of 0 means due
|
* @return Bearing from point 1 to point 2 in radians. A value of 0 means due
|
||||||
* north.
|
* north.
|
||||||
*/
|
*/
|
||||||
float GeoCoord::bearing(double lat1, double lon1, double lat2, double lon2)
|
float GeoCoord::bearing(double lat1, double lon1, double lat2, double lon2)
|
||||||
|
|
|
@ -89,26 +89,7 @@ bool NodeDB::resetRadioConfig()
|
||||||
|
|
||||||
// radioConfig.has_preferences = true;
|
// radioConfig.has_preferences = true;
|
||||||
if (config.device.factory_reset) {
|
if (config.device.factory_reset) {
|
||||||
DEBUG_MSG("Performing factory reset!\n");
|
didFactoryReset = factoryReset();
|
||||||
// first, remove the "/prefs" (this removes most prefs)
|
|
||||||
rmDir("/prefs");
|
|
||||||
// second, install default state (this will deal with the duplicate mac address issue)
|
|
||||||
installDefaultDeviceState();
|
|
||||||
// third, write to disk
|
|
||||||
saveToDisk();
|
|
||||||
#ifndef NO_ESP32
|
|
||||||
// This will erase what's in NVS including ssl keys, persistant variables and ble pairing
|
|
||||||
nvs_flash_erase();
|
|
||||||
#endif
|
|
||||||
#ifdef NRF52_SERIES
|
|
||||||
Bluefruit.begin();
|
|
||||||
DEBUG_MSG("Clearing bluetooth bonds!\n");
|
|
||||||
bond_print_list(BLE_GAP_ROLE_PERIPH);
|
|
||||||
bond_print_list(BLE_GAP_ROLE_CENTRAL);
|
|
||||||
Bluefruit.Periph.clearBonds();
|
|
||||||
Bluefruit.Central.clearBonds();
|
|
||||||
#endif
|
|
||||||
didFactoryReset = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channelFile.channels_count != MAX_NUM_CHANNELS) {
|
if (channelFile.channels_count != MAX_NUM_CHANNELS) {
|
||||||
|
@ -142,8 +123,33 @@ bool NodeDB::resetRadioConfig()
|
||||||
return didFactoryReset;
|
return didFactoryReset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NodeDB::factoryReset()
|
||||||
|
{
|
||||||
|
DEBUG_MSG("Performing factory reset!\n");
|
||||||
|
// first, remove the "/prefs" (this removes most prefs)
|
||||||
|
rmDir("/prefs");
|
||||||
|
// second, install default state (this will deal with the duplicate mac address issue)
|
||||||
|
installDefaultDeviceState();
|
||||||
|
// third, write to disk
|
||||||
|
saveToDisk();
|
||||||
|
#ifndef NO_ESP32
|
||||||
|
// This will erase what's in NVS including ssl keys, persistant variables and ble pairing
|
||||||
|
nvs_flash_erase();
|
||||||
|
#endif
|
||||||
|
#ifdef NRF52_SERIES
|
||||||
|
Bluefruit.begin();
|
||||||
|
DEBUG_MSG("Clearing bluetooth bonds!\n");
|
||||||
|
bond_print_list(BLE_GAP_ROLE_PERIPH);
|
||||||
|
bond_print_list(BLE_GAP_ROLE_CENTRAL);
|
||||||
|
Bluefruit.Periph.clearBonds();
|
||||||
|
Bluefruit.Central.clearBonds();
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void NodeDB::installDefaultConfig()
|
void NodeDB::installDefaultConfig()
|
||||||
{
|
{
|
||||||
|
DEBUG_MSG("Installing default LocalConfig\n");
|
||||||
memset(&config, 0, sizeof(LocalConfig));
|
memset(&config, 0, sizeof(LocalConfig));
|
||||||
config.version = DEVICESTATE_CUR_VER;
|
config.version = DEVICESTATE_CUR_VER;
|
||||||
config.has_device = true;
|
config.has_device = true;
|
||||||
|
@ -164,25 +170,28 @@ void NodeDB::installDefaultConfig()
|
||||||
|
|
||||||
void NodeDB::installDefaultModuleConfig()
|
void NodeDB::installDefaultModuleConfig()
|
||||||
{
|
{
|
||||||
|
DEBUG_MSG("Installing default ModuleConfig\n");
|
||||||
memset(&moduleConfig, 0, sizeof(ModuleConfig));
|
memset(&moduleConfig, 0, sizeof(ModuleConfig));
|
||||||
moduleConfig.version = DEVICESTATE_CUR_VER;
|
moduleConfig.version = DEVICESTATE_CUR_VER;
|
||||||
moduleConfig.has_canned_message = true;
|
|
||||||
moduleConfig.has_external_notification = true;
|
|
||||||
moduleConfig.has_mqtt = true;
|
moduleConfig.has_mqtt = true;
|
||||||
moduleConfig.has_range_test = true;
|
moduleConfig.has_range_test = true;
|
||||||
moduleConfig.has_serial = true;
|
moduleConfig.has_serial = true;
|
||||||
moduleConfig.has_store_forward = true;
|
moduleConfig.has_store_forward = true;
|
||||||
moduleConfig.has_telemetry = true;
|
moduleConfig.has_telemetry = true;
|
||||||
|
moduleConfig.has_external_notification = true;
|
||||||
|
moduleConfig.has_canned_message = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeDB::installDefaultChannels()
|
void NodeDB::installDefaultChannels()
|
||||||
{
|
{
|
||||||
|
DEBUG_MSG("Installing default ChannelFile\n");
|
||||||
memset(&channelFile, 0, sizeof(ChannelFile));
|
memset(&channelFile, 0, sizeof(ChannelFile));
|
||||||
channelFile.version = DEVICESTATE_CUR_VER;
|
channelFile.version = DEVICESTATE_CUR_VER;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeDB::installDefaultDeviceState()
|
void NodeDB::installDefaultDeviceState()
|
||||||
{
|
{
|
||||||
|
DEBUG_MSG("Installing default DeviceState\n");
|
||||||
memset(&devicestate, 0, sizeof(DeviceState));
|
memset(&devicestate, 0, sizeof(DeviceState));
|
||||||
|
|
||||||
*numNodes = 0; // Forget node DB
|
*numNodes = 0; // Forget node DB
|
||||||
|
@ -209,23 +218,17 @@ void NodeDB::installDefaultDeviceState()
|
||||||
|
|
||||||
sprintf(owner.id, "!%08x", getNodeNum()); // Default node ID now based on nodenum
|
sprintf(owner.id, "!%08x", getNodeNum()); // Default node ID now based on nodenum
|
||||||
memcpy(owner.macaddr, ourMacAddr, sizeof(owner.macaddr));
|
memcpy(owner.macaddr, ourMacAddr, sizeof(owner.macaddr));
|
||||||
|
|
||||||
installDefaultChannels();
|
|
||||||
installDefaultConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeDB::init()
|
void NodeDB::init()
|
||||||
{
|
{
|
||||||
installDefaultDeviceState();
|
DEBUG_MSG("Initializing NodeDB\n");
|
||||||
|
|
||||||
// saveToDisk();
|
// saveToDisk();
|
||||||
loadFromDisk();
|
loadFromDisk();
|
||||||
// saveToDisk();
|
|
||||||
|
|
||||||
myNodeInfo.max_channels = MAX_NUM_CHANNELS; // tell others the max # of channels we can understand
|
myNodeInfo.max_channels = MAX_NUM_CHANNELS; // tell others the max # of channels we can understand
|
||||||
|
|
||||||
myNodeInfo.error_code =
|
myNodeInfo.error_code = CriticalErrorCode_None; // For the error code, only show values from this boot (discard value from flash)
|
||||||
CriticalErrorCode_None; // For the error code, only show values from this boot (discard value from flash)
|
|
||||||
myNodeInfo.error_address = 0;
|
myNodeInfo.error_address = 0;
|
||||||
|
|
||||||
// likewise - we always want the app requirements to come from the running appload
|
// likewise - we always want the app requirements to come from the running appload
|
||||||
|
@ -259,8 +262,8 @@ void NodeDB::init()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
resetRadioConfig(); // If bogus settings got saved, then fix them
|
resetRadioConfig(); // If bogus settings got saved, then fix them
|
||||||
|
|
||||||
DEBUG_MSG("region=%d, NODENUM=0x%x, dbsize=%d\n", config.lora.region, myNodeInfo.my_node_num, *numNodes);
|
DEBUG_MSG("region=%d, NODENUM=0x%x, dbsize=%d\n", config.lora.region, myNodeInfo.my_node_num, *numNodes);
|
||||||
|
saveToDisk();
|
||||||
}
|
}
|
||||||
|
|
||||||
// We reserve a few nodenums for future use
|
// We reserve a few nodenums for future use
|
||||||
|
@ -290,10 +293,10 @@ void NodeDB::pickNewNodeNum()
|
||||||
myNodeInfo.my_node_num = r;
|
myNodeInfo.my_node_num = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *preffile = "/prefs/db.proto";
|
static const char *prefFileName = "/prefs/db.proto";
|
||||||
static const char *configfile = "/prefs/config.proto";
|
static const char *configFileName = "/prefs/config.proto";
|
||||||
static const char *moduleConfigfile = "/prefs/module.proto";
|
static const char *moduleConfigFileName = "/prefs/module.proto";
|
||||||
static const char *channelfile = "/prefs/channels.proto";
|
static const char *channelFileName = "/prefs/channels.proto";
|
||||||
|
|
||||||
/** Load a protobuf from a file, return true for success */
|
/** Load a protobuf from a file, return true for success */
|
||||||
bool loadProto(const char *filename, size_t protoSize, size_t objSize, const pb_msgdesc_t *fields, void *dest_struct)
|
bool loadProto(const char *filename, size_t protoSize, size_t objSize, const pb_msgdesc_t *fields, void *dest_struct)
|
||||||
|
@ -330,7 +333,7 @@ bool loadProto(const char *filename, size_t protoSize, size_t objSize, const pb_
|
||||||
void NodeDB::loadFromDisk()
|
void NodeDB::loadFromDisk()
|
||||||
{
|
{
|
||||||
// static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM
|
// static DeviceState scratch; We no longer read into a tempbuf because this structure is 15KB of valuable RAM
|
||||||
if (!loadProto(preffile, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate)) {
|
if (!loadProto(prefFileName, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate)) {
|
||||||
installDefaultDeviceState(); // Our in RAM copy might now be corrupt
|
installDefaultDeviceState(); // Our in RAM copy might now be corrupt
|
||||||
} else {
|
} else {
|
||||||
if (devicestate.version < DEVICESTATE_MIN_VER) {
|
if (devicestate.version < DEVICESTATE_MIN_VER) {
|
||||||
|
@ -353,7 +356,7 @@ void NodeDB::loadFromDisk()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!loadProto(configfile, LocalConfig_size, sizeof(LocalConfig), LocalConfig_fields, &config)) {
|
if (!loadProto(configFileName, LocalConfig_size, sizeof(LocalConfig), LocalConfig_fields, &config)) {
|
||||||
installDefaultConfig(); // Our in RAM copy might now be corrupt
|
installDefaultConfig(); // Our in RAM copy might now be corrupt
|
||||||
} else {
|
} else {
|
||||||
if (config.version < DEVICESTATE_MIN_VER) {
|
if (config.version < DEVICESTATE_MIN_VER) {
|
||||||
|
@ -364,7 +367,7 @@ void NodeDB::loadFromDisk()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!loadProto(moduleConfigfile, LocalModuleConfig_size, sizeof(LocalModuleConfig), LocalModuleConfig_fields, &moduleConfig)) {
|
if (!loadProto(moduleConfigFileName, 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
|
||||||
} else {
|
} else {
|
||||||
if (moduleConfig.version < DEVICESTATE_MIN_VER) {
|
if (moduleConfig.version < DEVICESTATE_MIN_VER) {
|
||||||
|
@ -375,7 +378,7 @@ void NodeDB::loadFromDisk()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!loadProto(channelfile, ChannelFile_size, sizeof(ChannelFile), ChannelFile_fields, &channelFile)) {
|
if (!loadProto(channelFileName, ChannelFile_size, sizeof(ChannelFile), ChannelFile_fields, &channelFile)) {
|
||||||
installDefaultChannels(); // Our in RAM copy might now be corrupt
|
installDefaultChannels(); // Our in RAM copy might now be corrupt
|
||||||
} else {
|
} else {
|
||||||
if (channelFile.version < DEVICESTATE_MIN_VER) {
|
if (channelFile.version < DEVICESTATE_MIN_VER) {
|
||||||
|
@ -428,7 +431,7 @@ void NodeDB::saveChannelsToDisk()
|
||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
FSCom.mkdir("/prefs");
|
FSCom.mkdir("/prefs");
|
||||||
#endif
|
#endif
|
||||||
saveProto(channelfile, ChannelFile_size, sizeof(ChannelFile), ChannelFile_fields, &channelFile);
|
saveProto(channelFileName, ChannelFile_size, sizeof(ChannelFile), ChannelFile_fields, &channelFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +441,7 @@ void NodeDB::saveToDisk()
|
||||||
#ifdef FSCom
|
#ifdef FSCom
|
||||||
FSCom.mkdir("/prefs");
|
FSCom.mkdir("/prefs");
|
||||||
#endif
|
#endif
|
||||||
saveProto(preffile, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate);
|
saveProto(prefFileName, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate);
|
||||||
|
|
||||||
// save all config segments
|
// save all config segments
|
||||||
config.has_device = true;
|
config.has_device = true;
|
||||||
|
@ -447,7 +450,7 @@ void NodeDB::saveToDisk()
|
||||||
config.has_position = true;
|
config.has_position = true;
|
||||||
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(configFileName, LocalConfig_size, sizeof(LocalConfig), LocalConfig_fields, &config);
|
||||||
|
|
||||||
moduleConfig.has_canned_message = true;
|
moduleConfig.has_canned_message = true;
|
||||||
moduleConfig.has_external_notification = true;
|
moduleConfig.has_external_notification = true;
|
||||||
|
@ -456,10 +459,9 @@ void NodeDB::saveToDisk()
|
||||||
moduleConfig.has_serial = true;
|
moduleConfig.has_serial = true;
|
||||||
moduleConfig.has_store_forward = true;
|
moduleConfig.has_store_forward = true;
|
||||||
moduleConfig.has_telemetry = true;
|
moduleConfig.has_telemetry = true;
|
||||||
saveProto(moduleConfigfile, LocalModuleConfig_size, sizeof(LocalModuleConfig), LocalModuleConfig_fields, &moduleConfig);
|
saveProto(moduleConfigFileName, LocalModuleConfig_size, sizeof(LocalModuleConfig), LocalModuleConfig_fields, &moduleConfig);
|
||||||
|
|
||||||
saveChannelsToDisk();
|
saveChannelsToDisk();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
DEBUG_MSG("***** DEVELOPMENT MODE - DO NOT RELEASE - not saving to flash *****\n");
|
DEBUG_MSG("***** DEVELOPMENT MODE - DO NOT RELEASE - not saving to flash *****\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,8 @@ class NodeDB
|
||||||
newStatus.notifyObservers(&status);
|
newStatus.notifyObservers(&status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool factoryReset();
|
||||||
|
|
||||||
/// read our db from flash
|
/// read our db from flash
|
||||||
void loadFromDisk();
|
void loadFromDisk();
|
||||||
|
|
||||||
|
|
|
@ -183,11 +183,47 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||||
config_state++;
|
config_state++;
|
||||||
// Advance when we have sent all of our config objects
|
// Advance when we have sent all of our config objects
|
||||||
if (config_state > Config_lora_tag) {
|
if (config_state > Config_lora_tag) {
|
||||||
|
state = STATE_SEND_MODULECONFIG;
|
||||||
|
config_state = ModuleConfig_mqtt_tag;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case STATE_SEND_MODULECONFIG:
|
||||||
|
fromRadioScratch.which_payloadVariant = FromRadio_moduleConfig_tag;
|
||||||
|
switch (config_state) {
|
||||||
|
case ModuleConfig_mqtt_tag:
|
||||||
|
fromRadioScratch.moduleConfig.which_payloadVariant = ModuleConfig_mqtt_tag;
|
||||||
|
fromRadioScratch.moduleConfig.payloadVariant.mqtt = moduleConfig.mqtt;
|
||||||
|
break;
|
||||||
|
case ModuleConfig_serial_tag:
|
||||||
|
fromRadioScratch.moduleConfig.which_payloadVariant = ModuleConfig_serial_tag;
|
||||||
|
fromRadioScratch.moduleConfig.payloadVariant.serial = moduleConfig.serial;
|
||||||
|
break;
|
||||||
|
case ModuleConfig_external_notification_tag:
|
||||||
|
fromRadioScratch.moduleConfig.which_payloadVariant = ModuleConfig_external_notification_tag;
|
||||||
|
fromRadioScratch.moduleConfig.payloadVariant.external_notification = moduleConfig.external_notification;
|
||||||
|
break;
|
||||||
|
case ModuleConfig_range_test_tag:
|
||||||
|
fromRadioScratch.moduleConfig.which_payloadVariant = ModuleConfig_range_test_tag;
|
||||||
|
fromRadioScratch.moduleConfig.payloadVariant.range_test = moduleConfig.range_test;
|
||||||
|
break;
|
||||||
|
case ModuleConfig_telemetry_tag:
|
||||||
|
fromRadioScratch.moduleConfig.which_payloadVariant = ModuleConfig_telemetry_tag;
|
||||||
|
fromRadioScratch.moduleConfig.payloadVariant.telemetry = moduleConfig.telemetry;
|
||||||
|
break;
|
||||||
|
case ModuleConfig_canned_message_tag:
|
||||||
|
fromRadioScratch.moduleConfig.which_payloadVariant = ModuleConfig_canned_message_tag;
|
||||||
|
fromRadioScratch.moduleConfig.payloadVariant.canned_message = moduleConfig.canned_message;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
config_state++;
|
||||||
|
// Advance when we have sent all of our ModuleConfig objects
|
||||||
|
if (config_state > ModuleConfig_canned_message_tag) {
|
||||||
state = STATE_SEND_NODEINFO;
|
state = STATE_SEND_NODEINFO;
|
||||||
config_state = Config_device_tag;
|
config_state = Config_device_tag;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE_SEND_NODEINFO: {
|
case STATE_SEND_NODEINFO: {
|
||||||
const NodeInfo *info = nodeInfoForPhone;
|
const NodeInfo *info = nodeInfoForPhone;
|
||||||
nodeInfoForPhone = NULL; // We just consumed a nodeinfo, will need a new one next time
|
nodeInfoForPhone = NULL; // We just consumed a nodeinfo, will need a new one next time
|
||||||
|
@ -265,6 +301,9 @@ bool PhoneAPI::available()
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case STATE_SEND_CONFIG:
|
case STATE_SEND_CONFIG:
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case STATE_SEND_MODULECONFIG:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case STATE_SEND_NODEINFO:
|
case STATE_SEND_NODEINFO:
|
||||||
|
|
|
@ -24,6 +24,7 @@ class PhoneAPI
|
||||||
STATE_SEND_MY_INFO, // send our my info record
|
STATE_SEND_MY_INFO, // send our my info record
|
||||||
STATE_SEND_GROUPS, // new in 1.3?
|
STATE_SEND_GROUPS, // new in 1.3?
|
||||||
STATE_SEND_CONFIG, // Replacement for the old Radioconfig
|
STATE_SEND_CONFIG, // Replacement for the old Radioconfig
|
||||||
|
STATE_SEND_MODULECONFIG, // Send Module specific config
|
||||||
STATE_SEND_NODEINFO, // states progress in this order as the device sends to to the client
|
STATE_SEND_NODEINFO, // states progress in this order as the device sends to to the client
|
||||||
STATE_SEND_COMPLETE_ID,
|
STATE_SEND_COMPLETE_ID,
|
||||||
STATE_SEND_PACKETS // send packets or debug strings
|
STATE_SEND_PACKETS // send packets or debug strings
|
||||||
|
|
|
@ -419,9 +419,8 @@ void RadioInterface::applyModemConfig()
|
||||||
saveChannelNum(channel_num);
|
saveChannelNum(channel_num);
|
||||||
saveFreq(freq + config.lora.frequency_offset);
|
saveFreq(freq + config.lora.frequency_offset);
|
||||||
|
|
||||||
DEBUG_MSG("Set radio: name=%s, config=%u, ch=%d, power=%d\n", channelName, loraConfig.modem_preset, channel_num, power);
|
DEBUG_MSG("Set radio: region=%s, name=%s, config=%u, ch=%d, power=%d\n", myRegion->name, channelName, loraConfig.modem_preset, channel_num, power);
|
||||||
DEBUG_MSG("Radio myRegion->freqStart / myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd,
|
DEBUG_MSG("Radio myRegion->freqStart / myRegion->freqEnd: %f -> %f (%f mhz)\n", myRegion->freqStart, myRegion->freqEnd, myRegion->freqEnd - myRegion->freqStart);
|
||||||
myRegion->freqEnd - myRegion->freqStart);
|
|
||||||
DEBUG_MSG("Radio myRegion->numChannels: %d\n", numChannels);
|
DEBUG_MSG("Radio myRegion->numChannels: %d\n", numChannels);
|
||||||
DEBUG_MSG("Radio channel_num: %d\n", channel_num);
|
DEBUG_MSG("Radio channel_num: %d\n", channel_num);
|
||||||
DEBUG_MSG("Radio frequency: %f\n", getFreq());
|
DEBUG_MSG("Radio frequency: %f\n", getFreq());
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#define PB_MESH_PB_H_INCLUDED
|
#define PB_MESH_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
#include "config.pb.h"
|
#include "config.pb.h"
|
||||||
|
#include "module_config.pb.h"
|
||||||
#include "portnums.pb.h"
|
#include "portnums.pb.h"
|
||||||
#include "telemetry.pb.h"
|
#include "telemetry.pb.h"
|
||||||
|
|
||||||
|
@ -652,6 +653,8 @@ typedef struct _FromRadio {
|
||||||
Not used on all transports, currently just used for the serial console.
|
Not used on all transports, currently just used for the serial console.
|
||||||
NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. */
|
NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps. */
|
||||||
bool rebooted;
|
bool rebooted;
|
||||||
|
/* Include module config */
|
||||||
|
ModuleConfig moduleConfig;
|
||||||
/* Log levels, chosen to match python logging conventions. */
|
/* Log levels, chosen to match python logging conventions. */
|
||||||
MeshPacket packet;
|
MeshPacket packet;
|
||||||
};
|
};
|
||||||
|
@ -856,6 +859,7 @@ extern "C" {
|
||||||
#define FromRadio_log_record_tag 7
|
#define FromRadio_log_record_tag 7
|
||||||
#define FromRadio_config_complete_id_tag 8
|
#define FromRadio_config_complete_id_tag 8
|
||||||
#define FromRadio_rebooted_tag 9
|
#define FromRadio_rebooted_tag 9
|
||||||
|
#define FromRadio_moduleConfig_tag 10
|
||||||
#define FromRadio_packet_tag 11
|
#define FromRadio_packet_tag 11
|
||||||
#define ToRadio_packet_tag 2
|
#define ToRadio_packet_tag 2
|
||||||
#define ToRadio_peer_info_tag 3
|
#define ToRadio_peer_info_tag 3
|
||||||
|
@ -1006,6 +1010,7 @@ X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,config,config), 6) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,log_record,log_record), 7) \
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,log_record,log_record), 7) \
|
||||||
X(a, STATIC, ONEOF, UINT32, (payloadVariant,config_complete_id,config_complete_id), 8) \
|
X(a, STATIC, ONEOF, UINT32, (payloadVariant,config_complete_id,config_complete_id), 8) \
|
||||||
X(a, STATIC, ONEOF, BOOL, (payloadVariant,rebooted,rebooted), 9) \
|
X(a, STATIC, ONEOF, BOOL, (payloadVariant,rebooted,rebooted), 9) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,moduleConfig,moduleConfig), 10) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 11)
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 11)
|
||||||
#define FromRadio_CALLBACK NULL
|
#define FromRadio_CALLBACK NULL
|
||||||
#define FromRadio_DEFAULT NULL
|
#define FromRadio_DEFAULT NULL
|
||||||
|
@ -1013,6 +1018,7 @@ X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 11)
|
||||||
#define FromRadio_payloadVariant_node_info_MSGTYPE NodeInfo
|
#define FromRadio_payloadVariant_node_info_MSGTYPE NodeInfo
|
||||||
#define FromRadio_payloadVariant_config_MSGTYPE Config
|
#define FromRadio_payloadVariant_config_MSGTYPE Config
|
||||||
#define FromRadio_payloadVariant_log_record_MSGTYPE LogRecord
|
#define FromRadio_payloadVariant_log_record_MSGTYPE LogRecord
|
||||||
|
#define FromRadio_payloadVariant_moduleConfig_MSGTYPE ModuleConfig
|
||||||
#define FromRadio_payloadVariant_packet_MSGTYPE MeshPacket
|
#define FromRadio_payloadVariant_packet_MSGTYPE MeshPacket
|
||||||
|
|
||||||
#define ToRadio_FIELDLIST(X, a) \
|
#define ToRadio_FIELDLIST(X, a) \
|
||||||
|
|
|
@ -356,8 +356,8 @@ String MQTT::downstreamPacketToJson(MeshPacket *mp)
|
||||||
{"payload", msgPayload}};
|
{"payload", msgPayload}};
|
||||||
|
|
||||||
// serialize and return it
|
// serialize and return it
|
||||||
std::string jsonStr = jsonObj.dump();
|
static std::string jsonStr = jsonObj.dump();
|
||||||
DEBUG_MSG("serialized json message: %s\n", jsonStr.c_str());
|
DEBUG_MSG("serialized json message: %s\n", jsonStr.c_str());
|
||||||
|
|
||||||
return jsonStr.c_str();
|
return jsonStr.c_str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[VERSION]
|
[VERSION]
|
||||||
major = 1
|
major = 1
|
||||||
minor = 3
|
minor = 3
|
||||||
build = 21
|
build = 22
|
||||||
|
|
Ładowanie…
Reference in New Issue