diff --git a/platformio.ini b/platformio.ini index 623df4017..951c274e2 100644 --- a/platformio.ini +++ b/platformio.ini @@ -101,6 +101,15 @@ build_flags = ${env.build_flags} -Os src_filter = ${env.src_filter} - +; Common libs for environmental measurements (not included in native / portduino) +[environmental] +lib_deps = + adafruit/DHT sensor library@^1.4.1 + adafruit/Adafruit Unified Sensor@^1.1.4 + paulstoffregen/OneWire@^2.3.5 + robtillaart/DS18B20@^0.1.11 + adafruit/Adafruit BME280 Library@^2.2.2 + ; Common settings for ESP targes, mixin with extends = esp32_base [esp32_base] extends = arduino_base @@ -119,15 +128,11 @@ build_flags = -DAXP_DEBUG_PORT=Serial lib_deps = ${arduino_base.lib_deps} + ${environmental.lib_deps} https://github.com/meshtastic/esp32_https_server.git - adafruit/DHT sensor library@^1.4.1 - adafruit/Adafruit Unified Sensor@^1.1.4 - paulstoffregen/OneWire@^2.3.5 - robtillaart/DS18B20@^0.1.11 h2zero/NimBLE-Arduino@1.3.4 tobozo/ESP32-targz@^1.1.4 arduino-libraries/NTPClient#531eff39d9fbc831f3d03f706a161739203fbe2a - adafruit/Adafruit BME280 Library@^2.2.2 # Hmm - this doesn't work yet # board_build.ldscript = linker/esp32.extram.bss.ld @@ -298,6 +303,7 @@ extends = nrf52_base build_flags = ${nrf52_base.build_flags} lib_deps = ${arduino_base.lib_deps} + ${environmental.lib_deps} Adafruit nRFCrypto # Adafruit TinyUSB Arduino # add Adafruit nRFCrypto platform IO automated scan is broken @@ -477,6 +483,7 @@ src_filter = - - - + - +<../variants/portduino> build_flags = ${arduino_base.build_flags} -O0 -I variants/portduino framework = arduino @@ -495,6 +502,7 @@ src_filter = - - - + - +<../variants/portduino> build_flags = ${arduino_base.build_flags} -O0 -lgpiod -I variants/portduino framework = arduino diff --git a/proto b/proto index 60cf05456..6c39b5bf4 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 60cf0545612bde3daf53f319db1b72d053f870d3 +Subproject commit 6c39b5bf472677122b3ebf77b434af09038ff0dc diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index 5adfd3d4d..39362ba1d 100644 --- a/src/mesh/generated/deviceonly.pb.h +++ b/src/mesh/generated/deviceonly.pb.h @@ -140,7 +140,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 10985 +#define DeviceState_size 10981 #define ChannelFile_size 832 #ifdef __cplusplus diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index b2701e9b1..39f49a80b 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -136,6 +136,8 @@ typedef struct _Data { uint32_t dest; uint32_t source; uint32_t request_id; + uint32_t reply_id; + bool is_tapback; } Data; typedef struct _LogRecord { @@ -236,8 +238,6 @@ typedef struct _MeshPacket { MeshPacket_Priority priority; int32_t rx_rssi; MeshPacket_Delayed delayed; - uint32_t reply_id; - bool is_tapback; } MeshPacket; typedef struct _NodeInfo { @@ -334,8 +334,8 @@ extern "C" { #define User_init_default {"", "", "", {0}, _HardwareModel_MIN, 0, _Team_MIN, 0, 0, 0} #define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}} #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, 0, _MeshPacket_Delayed_MIN, 0, 0} +#define Data_init_default {_PortNum_MIN, {0, {0}}, 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, 0, _MeshPacket_Delayed_MIN} #define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0} #define MyNodeInfo_init_default {0, 0, 0, "", "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0} #define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN} @@ -346,8 +346,8 @@ extern "C" { #define User_init_zero {"", "", "", {0}, _HardwareModel_MIN, 0, _Team_MIN, 0, 0, 0} #define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}} #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, 0, _MeshPacket_Delayed_MIN, 0, 0} +#define Data_init_zero {_PortNum_MIN, {0, {0}}, 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, 0, _MeshPacket_Delayed_MIN} #define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0} #define MyNodeInfo_init_zero {0, 0, 0, "", "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0} #define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN} @@ -362,6 +362,8 @@ extern "C" { #define Data_dest_tag 4 #define Data_source_tag 5 #define Data_request_id_tag 6 +#define Data_reply_id_tag 7 +#define Data_is_tapback_tag 8 #define LogRecord_message_tag 1 #define LogRecord_time_tag 2 #define LogRecord_source_tag 3 @@ -434,8 +436,6 @@ extern "C" { #define MeshPacket_priority_tag 12 #define MeshPacket_rx_rssi_tag 13 #define MeshPacket_delayed_tag 15 -#define MeshPacket_reply_id_tag 16 -#define MeshPacket_is_tapback_tag 17 #define NodeInfo_num_tag 1 #define NodeInfo_user_tag 2 #define NodeInfo_position_tag 3 @@ -518,7 +518,9 @@ X(a, STATIC, SINGULAR, BYTES, payload, 2) \ X(a, STATIC, SINGULAR, BOOL, want_response, 3) \ X(a, STATIC, SINGULAR, FIXED32, dest, 4) \ X(a, STATIC, SINGULAR, FIXED32, source, 5) \ -X(a, STATIC, SINGULAR, FIXED32, request_id, 6) +X(a, STATIC, SINGULAR, FIXED32, request_id, 6) \ +X(a, STATIC, SINGULAR, FIXED32, reply_id, 7) \ +X(a, STATIC, SINGULAR, BOOL, is_tapback, 8) #define Data_CALLBACK NULL #define Data_DEFAULT NULL @@ -535,9 +537,7 @@ X(a, STATIC, SINGULAR, UINT32, hop_limit, 10) \ X(a, STATIC, SINGULAR, BOOL, want_ack, 11) \ X(a, STATIC, SINGULAR, UENUM, priority, 12) \ X(a, STATIC, SINGULAR, INT32, rx_rssi, 13) \ -X(a, STATIC, SINGULAR, UENUM, delayed, 15) \ -X(a, STATIC, SINGULAR, FIXED32, reply_id, 16) \ -X(a, STATIC, SINGULAR, BOOL, is_tapback, 17) +X(a, STATIC, SINGULAR, UENUM, delayed, 15) #define MeshPacket_CALLBACK NULL #define MeshPacket_DEFAULT NULL #define MeshPacket_payloadVariant_decoded_MSGTYPE Data @@ -647,13 +647,13 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg; #define User_size 96 #define RouteDiscovery_size 40 #define Routing_size 42 -#define Data_size 260 -#define MeshPacket_size 320 +#define Data_size 267 +#define MeshPacket_size 318 #define NodeInfo_size 270 #define MyNodeInfo_size 457 #define LogRecord_size 81 #define FromRadio_size 466 -#define ToRadio_size 323 +#define ToRadio_size 321 #define ToRadio_PeerInfo_size 8 #ifdef __cplusplus diff --git a/src/plugins/esp32/EnvironmentalMeasurementPlugin.cpp b/src/plugins/EnvironmentalMeasurementPlugin.cpp similarity index 99% rename from src/plugins/esp32/EnvironmentalMeasurementPlugin.cpp rename to src/plugins/EnvironmentalMeasurementPlugin.cpp index 3e6e6152d..24ec1c586 100644 --- a/src/plugins/esp32/EnvironmentalMeasurementPlugin.cpp +++ b/src/plugins/EnvironmentalMeasurementPlugin.cpp @@ -39,8 +39,7 @@ int32_t EnvironmentalMeasurementPlugin::runOnce() { -#ifndef NO_ESP32 // this only works on ESP32 devices - +#ifndef PORTDUINO /* Uncomment the preferences below if you want to use the plugin without having to configure it from the PythonAPI or WebUI. diff --git a/src/plugins/esp32/EnvironmentalMeasurementPlugin.h b/src/plugins/EnvironmentalMeasurementPlugin.h similarity index 100% rename from src/plugins/esp32/EnvironmentalMeasurementPlugin.h rename to src/plugins/EnvironmentalMeasurementPlugin.h diff --git a/src/plugins/Plugins.cpp b/src/plugins/Plugins.cpp index 03ab1a8a0..a2e925cf4 100644 --- a/src/plugins/Plugins.cpp +++ b/src/plugins/Plugins.cpp @@ -11,9 +11,11 @@ #include "plugins/RoutingPlugin.h" #include "plugins/AdminPlugin.h" #include "plugins/CannedMessagePlugin.h" +#ifndef PORTDUINO +#include "plugins/EnvironmentalMeasurementPlugin.h" +#endif #ifndef NO_ESP32 #include "plugins/esp32/SerialPlugin.h" -#include "plugins/esp32/EnvironmentalMeasurementPlugin.h" #include "plugins/esp32/RangeTestPlugin.h" #include "plugins/esp32/StoreForwardPlugin.h" #endif @@ -38,7 +40,9 @@ void setupPlugins() new RotaryEncoderInterruptImpl1(); rotaryEncoderInterruptImpl1->init(); cannedMessagePlugin = new CannedMessagePlugin(); - +#ifndef PORTDUINO + new EnvironmentalMeasurementPlugin(); +#endif #ifndef NO_ESP32 // Only run on an esp32 based device. @@ -53,7 +57,6 @@ void setupPlugins() new RangeTestPlugin(); // new StoreForwardPlugin(); - new EnvironmentalMeasurementPlugin(); #endif // NOTE! This plugin must be added LAST because it likes to check for replies from other plugins and avoid sending extra acks