diff --git a/.github/ISSUE_TEMPLATE/New Board.yml b/.github/ISSUE_TEMPLATE/New Board.yml new file mode 100644 index 000000000..ad706f3c0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/New Board.yml @@ -0,0 +1,46 @@ +name: New Board +description: Request us to support new hardware +title: "[Board]: " +labels: ["enhancement", "triage"] +body: + - type: markdown + attributes: + value: | + Thanks for requesting a new board, this will not gurantee that we will support it, but will be on our radar. + + - type: dropdown + id: soc + attributes: + label: SOC + description: What SOC does your board have? + multiple: true + options: + - NRF52 + - ESP32 + - Other + validations: + required: true + + - type: input + id: lora + attributes: + label: Lora IC + description: What LoRa IC does the board have? + validations: + required: true + + - type: input + id: link + attributes: + label: Product Link + description: Where can we find this product? + validations: + required: true + + - type: textarea + id: body + attributes: + label: Description + description: Please provide any further details you think we may need. + validations: + required: true diff --git a/proto b/proto index 99ce57802..31eaff092 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 99ce57802da9e8a3106d29b94e14e4a090cde3b3 +Subproject commit 31eaff092449a75ebbbf0114cf120c746dc96349 diff --git a/src/esp32/main-esp32.cpp b/src/esp32/main-esp32.cpp index 2e012297b..07b0eb9ee 100644 --- a/src/esp32/main-esp32.cpp +++ b/src/esp32/main-esp32.cpp @@ -6,6 +6,7 @@ #ifdef USE_NEW_ESP32_BLUETOOTH #include "ESP32Bluetooth.h" +#include "mesh/http/WiFiAPClient.h" #else #include "nimble/BluetoothUtil.h" #endif @@ -41,13 +42,15 @@ static void printBLEinfo() { #ifdef USE_NEW_ESP32_BLUETOOTH void setBluetoothEnable(bool on) { - if (!esp32Bluetooth) { - esp32Bluetooth = new ESP32Bluetooth(); - } - if (on) { - esp32Bluetooth->setup(); - } else { - esp32Bluetooth->shutdown(); + if (!isWifiAvailable()) { + if (!esp32Bluetooth) { + esp32Bluetooth = new ESP32Bluetooth(); + } + if (on) { + esp32Bluetooth->setup(); + } else { + esp32Bluetooth->shutdown(); + } } } #endif diff --git a/src/gps/NMEAGPS.cpp b/src/gps/NMEAGPS.cpp index 359256a3d..5c1ebafa0 100644 --- a/src/gps/NMEAGPS.cpp +++ b/src/gps/NMEAGPS.cpp @@ -5,7 +5,7 @@ #include // GPS solutions older than this will be rejected - see TinyGPSDatum::age() -#define GPS_SOL_EXPIRY_MS 300 // in millis +#define GPS_SOL_EXPIRY_MS 5000 // in millis. give 1 second time to combine different sentences. NMEA Frequency isn't higher anyway #define NMEA_MSG_GXGSA "GNGSA" // GSA message (GPGSA, GNGSA etc) static int32_t toDegInt(RawDegrees d) @@ -64,7 +64,7 @@ The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of s t.tm_mon = d.month() - 1; t.tm_year = d.year() - 1900; t.tm_isdst = false; - DEBUG_MSG("NMEA GPS time %d\n", t.tm_sec); + DEBUG_MSG("NMEA GPS time %d-%d-%d %d:%d:%d\n", d.year(), d.month(), t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec); perhapsSetRTC(RTCQualityGPS, t); @@ -116,7 +116,7 @@ bool NMEAGPS::lookForLocation() (reader.time.age() < GPS_SOL_EXPIRY_MS) && (reader.date.age() < GPS_SOL_EXPIRY_MS))) { - DEBUG_MSG("SOME data is TOO OLD\n"); + DEBUG_MSG("SOME data is TOO OLD: LOC %u, TIME %u, DATE %u\n", reader.location.age(), reader.time.age(), reader.date.age()); return false; } diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index c751a7c26..36d3b2251 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -239,8 +239,8 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus) pos.time = getValidTime(RTCQualityGPS); // In debug logs, identify position by @timestamp:stage (stage 4 = nodeDB) - DEBUG_MSG("onGPSChanged() pos@%x:4, time=%u, lat=%d\n", - pos.pos_timestamp, pos.time, pos.latitude_i); + DEBUG_MSG("onGPSChanged() pos@%x, time=%u, lat=%d, lon=%d, alt=%d\n", + pos.pos_timestamp, pos.time, pos.latitude_i, pos.longitude_i, pos.altitude); // Update our current position in the local DB nodeDB.updatePosition(nodeDB.getNodeNum(), pos, RX_SRC_LOCAL); diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 52e76a88e..a394db13e 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -453,8 +453,8 @@ void NodeDB::updatePosition(uint32_t nodeId, const Position &p, RxSource src) if (src == RX_SRC_LOCAL) { // Local packet, fully authoritative - DEBUG_MSG("updatePosition LOCAL pos@%x:5, time=%u, latI=%d, lonI=%d\n", - p.pos_timestamp, p.time, p.latitude_i, p.longitude_i); + DEBUG_MSG("updatePosition LOCAL pos@%x, time=%u, latI=%d, lonI=%d, alt=%d\n", + p.pos_timestamp, p.time, p.latitude_i, p.longitude_i, p.altitude); info->position = p; } else if ((p.time > 0) && !p.latitude_i && !p.longitude_i && !p.pos_timestamp && @@ -506,8 +506,8 @@ void NodeDB::updateTelemetry(uint32_t nodeId, const Telemetry &t, RxSource src) } else { DEBUG_MSG("updateTelemetry REMOTE node=0x%x \n", nodeId); } - info->telemetry = t; - info->has_telemetry = true; + info->device_metrics = t.variant.device_metrics; + info->has_device_metrics = true; updateGUIforNode = info; notifyObservers(true); // Force an update whether or not our node counts have changed } diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index 0dc8daa33..8250cf568 100644 --- a/src/mesh/generated/deviceonly.pb.h +++ b/src/mesh/generated/deviceonly.pb.h @@ -108,7 +108,7 @@ extern const pb_msgdesc_t ChannelFile_msg; /* Maximum encoded size of messages (where known) */ #define ChannelFile_size 832 -#define DeviceState_size 25183 +#define DeviceState_size 23903 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index aef07ed15..eadcfa32a 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -562,9 +562,9 @@ typedef struct _NodeInfo { float snr; /* Set to indicate the last time we received a packet from this node */ uint32_t last_heard; - /* The latest device telemetry data for the node. */ - bool has_telemetry; - Telemetry telemetry; + /* The latest device metrics for the node. */ + bool has_device_metrics; + DeviceMetrics device_metrics; } NodeInfo; /* A Routing control Data packet handled by the routing module */ @@ -737,7 +737,7 @@ extern "C" { #define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, Location_init_default} #define Location_init_default {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, false, Telemetry_init_default} +#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0, false, DeviceMetrics_init_default} #define MyNodeInfo_init_default {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} #define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN} #define FromRadio_init_default {0, 0, {MyNodeInfo_init_default}} @@ -750,7 +750,7 @@ extern "C" { #define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, Location_init_zero} #define Location_init_zero {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, false, Telemetry_init_zero} +#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0, false, DeviceMetrics_init_zero} #define MyNodeInfo_init_zero {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} #define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN} #define FromRadio_init_zero {0, 0, {MyNodeInfo_init_zero}} @@ -833,7 +833,7 @@ extern "C" { #define NodeInfo_position_tag 3 #define NodeInfo_snr_tag 4 #define NodeInfo_last_heard_tag 5 -#define NodeInfo_telemetry_tag 6 +#define NodeInfo_device_metrics_tag 6 #define Routing_route_request_tag 1 #define Routing_route_reply_tag 2 #define Routing_error_reason_tag 3 @@ -964,12 +964,12 @@ X(a, STATIC, OPTIONAL, MESSAGE, user, 2) \ X(a, STATIC, OPTIONAL, MESSAGE, position, 3) \ X(a, STATIC, SINGULAR, FLOAT, snr, 4) \ X(a, STATIC, SINGULAR, FIXED32, last_heard, 5) \ -X(a, STATIC, OPTIONAL, MESSAGE, telemetry, 6) +X(a, STATIC, OPTIONAL, MESSAGE, device_metrics, 6) #define NodeInfo_CALLBACK NULL #define NodeInfo_DEFAULT NULL #define NodeInfo_user_MSGTYPE User #define NodeInfo_position_MSGTYPE Position -#define NodeInfo_telemetry_MSGTYPE Telemetry +#define NodeInfo_device_metrics_MSGTYPE DeviceMetrics #define MyNodeInfo_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, my_node_num, 1) \ @@ -1067,7 +1067,7 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg; #define LogRecord_size 81 #define MeshPacket_size 347 #define MyNodeInfo_size 210 -#define NodeInfo_size 299 +#define NodeInfo_size 283 #define Position_size 142 #define RouteDiscovery_size 40 #define Routing_size 42 diff --git a/src/mesh/generated/telemetry.pb.h b/src/mesh/generated/telemetry.pb.h index b3bf3df1d..1fb5ea0d7 100644 --- a/src/mesh/generated/telemetry.pb.h +++ b/src/mesh/generated/telemetry.pb.h @@ -40,10 +40,10 @@ typedef struct _EnvironmentMetrics { /* Types of Measurements the telemetry module is equipped to handle */ typedef struct _Telemetry { - /* This is usually not sent over the mesh (to save space), but it is sent - from the phone so that the local device can set its RTC If it is sent over - the mesh (because there are devices on the mesh without GPS), it will only - be sent by devices which has a hardware GPS clock (IE Mobile Phone). + /* This is usually not sent over the mesh (to save space), but it is sent + from the phone so that the local device can set its RTC If it is sent over + the mesh (because there are devices on the mesh without GPS), it will only + be sent by devices which has a hardware GPS clock (IE Mobile Phone). seconds since 1970 */ uint32_t time; /* Key native device metrics such as battery level */ diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 1db82e903..aa52cf6cd 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -307,6 +307,12 @@ void CannedMessageModule::drawFrame( display->setFont(FONT_MEDIUM); display->drawString(display->getWidth()/2 + x, 0 + y + 12, "Sending..."); } + else if (cannedMessageModule->runState == CANNED_MESSAGE_RUN_STATE_DISABLED) + { + display->setTextAlignment(TEXT_ALIGN_LEFT); + display->setFont(FONT_SMALL); + display->drawString(10 + x, 0 + y + 16, "Canned Message\nModule disabled."); + } else { display->setTextAlignment(TEXT_ALIGN_LEFT); diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index 7d65acc89..0221418e6 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -13,8 +13,8 @@ #include "modules/ReplyModule.h" #include "modules/RoutingModule.h" #include "modules/TextMessageModule.h" -#ifndef PORTDUINO #include "modules/Telemetry/DeviceTelemetry.h" +#ifndef PORTDUINO #include "modules/Telemetry/EnvironmentTelemetry.h" #endif #ifndef NO_ESP32 @@ -68,4 +68,4 @@ void setupModules() // NOTE! This module must be added LAST because it likes to check for replies from other modules and avoid sending extra acks routingModule = new RoutingModule(); -} \ No newline at end of file +} diff --git a/variants/heltec_v2.1/variant.h b/variants/heltec_v2.1/variant.h index 2c0f4e165..d2c00a18c 100644 --- a/variants/heltec_v2.1/variant.h +++ b/variants/heltec_v2.1/variant.h @@ -1,9 +1,12 @@ -// the default ESP32 Pin of 15 is the Oled SCL, set to 36 and 37 and works fine. +// Pin planning should refer to this document +// https://resource.heltec.cn/download/WiFi_LoRa_32/WIFI_LoRa_32_V2.pdf + +// the default ESP32 Pin of 15 is the Oled SCL, 37 is battery pin. // Tested on Neo6m module. #undef GPS_RX_PIN #undef GPS_TX_PIN #define GPS_RX_PIN 36 -#define GPS_TX_PIN 37 +#define GPS_TX_PIN 33 #ifndef USE_JTAG // gpio15 is TDO for JTAG, so no I2C on this board while doing jtag #define I2C_SDA 4 // I2C pins for this board