diff --git a/docs/software/TODO.md b/docs/software/TODO.md index c6625e8e..9633c021 100644 --- a/docs/software/TODO.md +++ b/docs/software/TODO.md @@ -4,12 +4,14 @@ You probably don't care about this section - skip to the next one. ## 1.2 cleanup & multichannel support: -* cleanup the external notification and serial plugins +* DONE cleanup the external notification and serial plugins * non ack version of stress test fails sometimes! * timestamps on oled screen are wrong - don't seem to be updating based on message rx * luxon bug report - seeing rx acks for nodes that are not on the network * channel hash suffixes are wrong on android * tx fault test has a bug #734 +* DONE move device types into an enum in nodeinfo +* fix android to use new device types for firmware update * cdcacm bug on nrf52: emittx thinks it emitted but client sees nothing. works again later * nrf52: segger logs have errors in formatting that should be impossible (because not going through serial, try stalling on segger) diff --git a/proto b/proto index bf8ac671..b6fdb78c 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit bf8ac6718c08fe7c94a9896d91ef85572694f7b0 +Subproject commit b6fdb78c0738d0f348ae45f76de4e6360c7e479e diff --git a/src/configuration.h b/src/configuration.h index cb68a2e3..fb84203d 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -163,7 +163,7 @@ along with this program. If not, see . #if defined(TBEAM_V10) // This string must exactly match the case used in release file names or the android updater won't work -#define HW_VENDOR "tbeam" +#define HW_VENDOR NodeInfo_HardwareModel_TBEAM // #define BUTTON_NEED_PULLUP // if set we need to turn on the internal CPU pullup during sleep @@ -204,7 +204,7 @@ along with this program. If not, see . #elif defined(TBEAM_V07) // This string must exactly match the case used in release file names or the android updater won't work -#define HW_VENDOR "tbeam0.7" +#define HW_VENDOR NodeInfo_HardwareModel_TBEAM0p7 // #define BUTTON_NEED_PULLUP // if set we need to turn on the internal CPU pullup during sleep @@ -228,7 +228,7 @@ along with this program. If not, see . #elif defined(ARDUINO_HELTEC_WIFI_LORA_32_V2) // This string must exactly match the case used in release file names or the android updater won't work -#define HW_VENDOR "heltec" +#define HW_VENDOR NodeInfo_HardwareModel_HELTEC // the default ESP32 Pin of 15 is the Oled SCL, set to 36 and 37 and works fine. // Tested on Neo6m module. @@ -258,7 +258,7 @@ along with this program. If not, see . #elif defined(TLORA_V1) // This string must exactly match the case used in release file names or the android updater won't work -#define HW_VENDOR "tlora-v1" +#define HW_VENDOR NodeInfo_HardwareModel_TLORA_V1 #undef GPS_RX_PIN #undef GPS_TX_PIN #define GPS_RX_PIN 36 @@ -282,7 +282,7 @@ along with this program. If not, see . #elif defined(TLORA_V2) // This string must exactly match the case used in release file names or the android updater won't work -#define HW_VENDOR "tlora-v2" +#define HW_VENDOR NodeInfo_HardwareModel_TLORA_V2 #undef GPS_RX_PIN #undef GPS_TX_PIN @@ -311,7 +311,7 @@ along with this program. If not, see . #elif defined(TLORA_V1_3) // This string must exactly match the case used in release file names or the android updater won't work -#define HW_VENDOR "tlora-v1-3" +#define HW_VENDOR NodeInfo_HardwareModel_TLORA_V1p3 #undef GPS_RX_PIN #undef GPS_TX_PIN @@ -338,7 +338,7 @@ along with this program. If not, see . #elif defined(TLORA_V2_1_16) // This string must exactly match the case used in release file names or the android updater won't work -#define HW_VENDOR "tlora-v2-1-1.6" +#define HW_VENDOR NodeInfo_HardwareModel_TLORA_V2_1p6_ #undef GPS_RX_PIN #undef GPS_TX_PIN @@ -366,7 +366,7 @@ along with this program. If not, see . #elif defined(GENIEBLOCKS) // This string must exactly match the case used in release file names or the android updater won't work -#define HW_VENDOR "genieblocks" +#define HW_VENDOR NodeInfo_HardwareModel_GENIEBLOCKS #undef GPS_RX_PIN #undef GPS_TX_PIN #define GPS_RX_PIN 5 @@ -399,7 +399,7 @@ along with this program. If not, see . #ifdef ARDUINO_NRF52840_PCA10056 // This string must exactly match the case used in release file names or the android updater won't work -#define HW_VENDOR "nrf52dk" +#define HW_VENDOR NodeInfo_HardwareModel_NRF52840DK // This board uses 0 to be mean LED on #undef LED_INVERTED @@ -407,15 +407,15 @@ along with this program. If not, see . #elif defined(ARDUINO_NRF52840_PPR) -#define HW_VENDOR "ppr" +#define HW_VENDOR NodeInfo_HardwareModel_PPR #elif NRF52_SERIES -#define HW_VENDOR "nrf52unknown" // FIXME - unknown nrf52 board +#define HW_VENDOR NodeInfo_HardwareModel_NRF52_UNKNOWN #elif PORTDUINO -#define HW_VENDOR "portduino" +#define HW_VENDOR NodeInfo_HardwareModel_PORTDUINO #define USE_SIM_RADIO diff --git a/src/main.cpp b/src/main.cpp index d4eaafae..d0c02400 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -365,7 +365,7 @@ void setup() #endif // Hello - DEBUG_MSG("Meshtastic hwvendor=%s, swver=%s, hwver=%s\n", HW_VENDOR, optstr(APP_VERSION), optstr(HW_VERSION)); + DEBUG_MSG("Meshtastic hwvendor=%d, swver=%s, hwver=%s\n", HW_VENDOR, optstr(APP_VERSION), optstr(HW_VERSION)); #ifndef NO_ESP32 // Don't init display if we don't have one or we are waking headless due to a timer event diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 1840aa36..363f8432 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -199,6 +199,7 @@ void NodeDB::init() NodeInfo *info = getOrCreateNode(getNodeNum()); info->user = owner; info->has_user = true; + info->hw_model = HW_VENDOR; // removed from 1.2 (though we do use old values if found) // We set these _after_ loading from disk - because they come from the build and are more trusted than @@ -223,7 +224,10 @@ void NodeDB::init() } strncpy(myNodeInfo.firmware_version, optstr(APP_VERSION), sizeof(myNodeInfo.firmware_version)); - strncpy(myNodeInfo.hw_model, HW_VENDOR, sizeof(myNodeInfo.hw_model)); + + // hw_model is no longer stored in myNodeInfo (as of 1.2.11) - we now store it as an enum in nodeinfo + myNodeInfo.hw_model[0] = '\0'; + // strncpy(myNodeInfo.hw_model, HW_VENDOR, sizeof(myNodeInfo.hw_model)); resetRadioConfig(); // If bogus settings got saved, then fix them diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index 9c40e211..dec0eb35 100644 --- a/src/mesh/generated/deviceonly.pb.h +++ b/src/mesh/generated/deviceonly.pb.h @@ -125,7 +125,7 @@ extern const pb_msgdesc_t ChannelFile_msg; /* Maximum encoded size of messages (where known) */ #define LegacyRadioConfig_size 4 #define LegacyRadioConfig_LegacyPreferences_size 2 -#define DeviceState_size 5056 +#define DeviceState_size 4896 #define ChannelFile_size 832 #ifdef __cplusplus diff --git a/src/mesh/generated/mesh.pb.c b/src/mesh/generated/mesh.pb.c index ab27832f..b2cc65f0 100644 --- a/src/mesh/generated/mesh.pb.c +++ b/src/mesh/generated/mesh.pb.c @@ -45,3 +45,4 @@ PB_BIND(ToRadio, ToRadio, 2) + diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 10487e40..72880434 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -51,6 +51,24 @@ typedef enum _MeshPacket_Priority { MeshPacket_Priority_MAX = 127 } MeshPacket_Priority; +typedef enum _NodeInfo_HardwareModel { + NodeInfo_HardwareModel_UNSET = 0, + NodeInfo_HardwareModel_TLORA_V2 = 1, + NodeInfo_HardwareModel_TLORA_V1 = 2, + NodeInfo_HardwareModel_TLORA_V2_1_1p6 = 3, + NodeInfo_HardwareModel_TBEAM = 4, + NodeInfo_HardwareModel_HELTEC = 5, + NodeInfo_HardwareModel_TBEAM0p7 = 6, + NodeInfo_HardwareModel_T_ECHO = 7, + NodeInfo_HardwareModel_TLORA_V1_1p3 = 8, + NodeInfo_HardwareModel_LORA_RELAY_V1 = 32, + NodeInfo_HardwareModel_NRF52840DK = 33, + NodeInfo_HardwareModel_PPR = 34, + NodeInfo_HardwareModel_GENIEBLOCKS = 35, + NodeInfo_HardwareModel_NRF52_UNKNOWN = 36, + NodeInfo_HardwareModel_PORTDUINO = 37 +} NodeInfo_HardwareModel; + typedef enum _LogRecord_Level { LogRecord_Level_UNSET = 0, LogRecord_Level_CRITICAL = 50, @@ -138,7 +156,7 @@ typedef struct _NodeInfo { User user; bool has_position; Position position; - uint32_t next_hop; + NodeInfo_HardwareModel hw_model; float snr; } NodeInfo; @@ -190,6 +208,10 @@ typedef struct _ToRadio { #define _MeshPacket_Priority_MAX MeshPacket_Priority_MAX #define _MeshPacket_Priority_ARRAYSIZE ((MeshPacket_Priority)(MeshPacket_Priority_MAX+1)) +#define _NodeInfo_HardwareModel_MIN NodeInfo_HardwareModel_UNSET +#define _NodeInfo_HardwareModel_MAX NodeInfo_HardwareModel_PORTDUINO +#define _NodeInfo_HardwareModel_ARRAYSIZE ((NodeInfo_HardwareModel)(NodeInfo_HardwareModel_PORTDUINO+1)) + #define _LogRecord_Level_MIN LogRecord_Level_UNSET #define _LogRecord_Level_MAX LogRecord_Level_CRITICAL #define _LogRecord_Level_ARRAYSIZE ((LogRecord_Level)(LogRecord_Level_CRITICAL+1)) @@ -206,7 +228,7 @@ extern "C" { #define Routing_init_default {0, {RouteDiscovery_init_default}} #define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0} #define MeshPacket_init_default {0, 0, 0, 0, {Data_init_default}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN} -#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0} +#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, _NodeInfo_HardwareModel_MIN, 0} #define MyNodeInfo_init_default {0, 0, 0, "", "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0} #define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN} #define FromRadio_init_default {0, 0, {MyNodeInfo_init_default}} @@ -217,7 +239,7 @@ extern "C" { #define Routing_init_zero {0, {RouteDiscovery_init_zero}} #define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0} #define MeshPacket_init_zero {0, 0, 0, 0, {Data_init_zero}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN} -#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0} +#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, _NodeInfo_HardwareModel_MIN, 0} #define MyNodeInfo_init_zero {0, 0, 0, "", "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0} #define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN} #define FromRadio_init_zero {0, 0, {MyNodeInfo_init_zero}} @@ -270,7 +292,7 @@ extern "C" { #define NodeInfo_num_tag 1 #define NodeInfo_user_tag 2 #define NodeInfo_position_tag 3 -#define NodeInfo_next_hop_tag 5 +#define NodeInfo_hw_model_tag 6 #define NodeInfo_snr_tag 7 #define Routing_route_request_tag 1 #define Routing_route_reply_tag 2 @@ -347,7 +369,7 @@ X(a, STATIC, SINGULAR, UENUM, priority, 12) X(a, STATIC, SINGULAR, UINT32, num, 1) \ X(a, STATIC, OPTIONAL, MESSAGE, user, 2) \ X(a, STATIC, OPTIONAL, MESSAGE, position, 3) \ -X(a, STATIC, SINGULAR, UINT32, next_hop, 5) \ +X(a, STATIC, SINGULAR, UENUM, hw_model, 6) \ X(a, STATIC, SINGULAR, FLOAT, snr, 7) #define NodeInfo_CALLBACK NULL #define NodeInfo_DEFAULT NULL @@ -432,7 +454,7 @@ extern const pb_msgdesc_t ToRadio_msg; #define Routing_size 42 #define Data_size 260 #define MeshPacket_size 298 -#define NodeInfo_size 130 +#define NodeInfo_size 126 #define MyNodeInfo_size 89 #define LogRecord_size 81 #define FromRadio_size 307 diff --git a/src/nrf52/NRF52Bluetooth.cpp b/src/nrf52/NRF52Bluetooth.cpp index 35093ff1..244918e9 100644 --- a/src/nrf52/NRF52Bluetooth.cpp +++ b/src/nrf52/NRF52Bluetooth.cpp @@ -224,7 +224,8 @@ void NRF52Bluetooth::setup() // Configure and Start the Device Information Service DEBUG_MSG("Configuring the Device Information Service\n"); - bledis.setManufacturer(HW_VENDOR); + // FIXME, we should set a mfg string based on our HW_VENDOR enum + // bledis.setManufacturer(HW_VENDOR); bledis.setModel(optstr(HW_VERSION)); bledis.setFirmwareRev(optstr(APP_VERSION)); bledis.begin();