From 4796c8edc488b71571ad5c1eeb9905abde09cbc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 26 Feb 2024 17:38:16 +0100 Subject: [PATCH 1/5] Update trunk to latest version (#3295) --- .trunk/.gitignore | 1 + .trunk/trunk.yaml | 32 +++++++++++++++++--------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.trunk/.gitignore b/.trunk/.gitignore index 1e2465290..15966d087 100644 --- a/.trunk/.gitignore +++ b/.trunk/.gitignore @@ -6,3 +6,4 @@ plugins user_trunk.yaml user.yaml +tmp diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 81a35f8f1..af7d3d21d 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,34 +1,36 @@ version: 0.1 cli: - version: 1.17.2 + version: 1.20.1 plugins: sources: - id: trunk - ref: v1.3.0 + ref: v1.4.3 uri: https://github.com/trunk-io/plugins lint: enabled: - - bandit@1.7.5 - - checkov@3.1.9 - - terrascan@1.18.5 - - trivy@0.47.0 + - trufflehog@3.68.2 + - yamllint@1.35.1 + - bandit@1.7.7 + - checkov@3.2.26 + - terrascan@1.18.11 + - trivy@0.49.1 #- trufflehog@3.63.2-rc0 - taplo@0.8.1 - - ruff@0.1.6 - - isort@5.12.0 - - markdownlint@0.37.0 + - ruff@0.2.2 + - isort@5.13.2 + - markdownlint@0.39.0 - oxipng@9.0.0 - - svgo@3.0.5 - - actionlint@1.6.26 - - flake8@6.1.0 + - svgo@3.2.0 + - actionlint@1.6.27 + - flake8@7.0.0 - hadolint@2.12.0 - shfmt@3.6.0 - shellcheck@0.9.0 - - black@23.9.1 + - black@24.2.0 - git-diff-check - - gitleaks@8.18.1 + - gitleaks@8.18.2 - clang-format@16.0.3 - - prettier@3.1.0 + - prettier@3.2.5 runtimes: enabled: - python@3.10.8 From 59bbd1ad00fafc18553cd01f4673fd9deac4af2e Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 26 Feb 2024 19:32:58 -0600 Subject: [PATCH 2/5] Revert I2C changes --- variants/heltec_wireless_tracker_V1_0/pins_arduino.h | 4 ++-- variants/heltec_wireless_tracker_V1_0/platformio.ini | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/variants/heltec_wireless_tracker_V1_0/pins_arduino.h b/variants/heltec_wireless_tracker_V1_0/pins_arduino.h index 5c0b529b0..42c5770a9 100644 --- a/variants/heltec_wireless_tracker_V1_0/pins_arduino.h +++ b/variants/heltec_wireless_tracker_V1_0/pins_arduino.h @@ -26,8 +26,8 @@ static const uint8_t LED_BUILTIN = 18; static const uint8_t TX = 43; static const uint8_t RX = 44; -static const uint8_t SDA = 45; -static const uint8_t SCL = 46; +static const uint8_t SDA = 41; +static const uint8_t SCL = 42; static const uint8_t SS = 8; static const uint8_t MOSI = 10; diff --git a/variants/heltec_wireless_tracker_V1_0/platformio.ini b/variants/heltec_wireless_tracker_V1_0/platformio.ini index 034360c3d..303e27dbf 100644 --- a/variants/heltec_wireless_tracker_V1_0/platformio.ini +++ b/variants/heltec_wireless_tracker_V1_0/platformio.ini @@ -1,7 +1,7 @@ [env:heltec-wireless-tracker-V1-0] extends = esp32s3_base board = heltec_wireless_tracker -upload_protocol = esp-builtin +upload_protocol = esptool build_flags = ${esp32s3_base.build_flags} -I variants/heltec_wireless_tracker_V1_0 From ce0e5c0ce72db7746c923a0ede1d8e84b92032dd Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 26 Feb 2024 19:49:43 -0600 Subject: [PATCH 3/5] SDA and SCL remap --- variants/heltec_wireless_tracker_V1_0/pins_arduino.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/variants/heltec_wireless_tracker_V1_0/pins_arduino.h b/variants/heltec_wireless_tracker_V1_0/pins_arduino.h index 42c5770a9..f72c7661a 100644 --- a/variants/heltec_wireless_tracker_V1_0/pins_arduino.h +++ b/variants/heltec_wireless_tracker_V1_0/pins_arduino.h @@ -26,8 +26,8 @@ static const uint8_t LED_BUILTIN = 18; static const uint8_t TX = 43; static const uint8_t RX = 44; -static const uint8_t SDA = 41; -static const uint8_t SCL = 42; +static const uint8_t SDA = 5; +static const uint8_t SCL = 6; static const uint8_t SS = 8; static const uint8_t MOSI = 10; From e6a2c06346e37a2a9b03469ba6a60d3632ddb51d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 26 Feb 2024 20:24:36 -0600 Subject: [PATCH 4/5] Various position fixes (#3297) * Guard against no movement * Add newlines * Fix printfs --- src/gps/GPS.cpp | 6 ++---- src/gps/GeoCoord.cpp | 15 +++++++++------ src/gps/GeoCoord.h | 1 + src/modules/PositionModule.cpp | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 08ef116b2..3a3660308 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -319,7 +319,6 @@ bool GPS::setup() delay(250); _serial_gps->write("$CFGMSG,6,1,0\r\n"); delay(250); - } else if (gnssModel == GNSS_MODEL_UBLOX) { // Configure GNSS system to GPS+SBAS+GLONASS (Module may restart after this command) // We need set it because by default it is GPS only, and we want to use GLONASS too @@ -458,7 +457,6 @@ bool GPS::setup() LOG_WARN("Unable to enable NMEA 4.10.\n"); } } - } else { if (strncmp(info.hwVersion, "00040007", 8) == 0) { // This PSM mode is only for Neo-6 msglen = makeUBXPacket(0x06, 0x11, 0x2, _message_CFG_RXM_ECO); @@ -642,12 +640,12 @@ void GPS::setGPSPower(bool on, bool standbyOnly, uint32_t sleepTime) #endif #ifdef PIN_GPS_STANDBY // Specifically the standby pin for L76K and clones if (on) { - LOG_INFO("Waking GPS"); + LOG_INFO("Waking GPS\n"); pinMode(PIN_GPS_STANDBY, OUTPUT); digitalWrite(PIN_GPS_STANDBY, 1); return; } else { - LOG_INFO("GPS entering sleep"); + LOG_INFO("GPS entering sleep\n"); // notifyGPSSleep.notifyObservers(NULL); pinMode(PIN_GPS_STANDBY, OUTPUT); digitalWrite(PIN_GPS_STANDBY, 0); diff --git a/src/gps/GeoCoord.cpp b/src/gps/GeoCoord.cpp index 19a753c02..cb4e69ff2 100644 --- a/src/gps/GeoCoord.cpp +++ b/src/gps/GeoCoord.cpp @@ -376,14 +376,17 @@ void GeoCoord::convertWGS84ToOSGB36(const double lat, const double lon, double & } /// Ported from my old java code, returns distance in meters along the globe -/// surface (by magic?) +/// surface (by Haversine formula) float GeoCoord::latLongToMeter(double lat_a, double lng_a, double lat_b, double lng_b) { - double pk = (180 / 3.14169); - double a1 = lat_a / pk; - double a2 = lng_a / pk; - double b1 = lat_b / pk; - double b2 = lng_b / pk; + // Don't do math if the points are the same + if (lat_a == lat_b && lng_a == lng_b) + return 0.0; + + double a1 = lat_a / DEG_CONVERT; + double a2 = lng_a / DEG_CONVERT; + double b1 = lat_b / DEG_CONVERT; + double b2 = lng_b / DEG_CONVERT; double cos_b1 = cos(b1); double cos_a1 = cos(a1); double t1 = cos_a1 * cos(a2) * cos_b1 * cos(b2); diff --git a/src/gps/GeoCoord.h b/src/gps/GeoCoord.h index 06b11c3de..9f911ed93 100644 --- a/src/gps/GeoCoord.h +++ b/src/gps/GeoCoord.h @@ -11,6 +11,7 @@ #define PI 3.1415926535897932384626433832795 #define OLC_CODE_LEN 11 +#define DEG_CONVERT 180 / PI // Helper functions // Raises a number to an exponent, handling negative exponents. diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index 92e8f8a4d..1e4ea5de1 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -372,7 +372,7 @@ struct SmartPosition PositionModule::getDistanceTraveledSinceLastSend(meshtastic LOG_DEBUG("currentPosition.latitude_i=%i, currentPosition.longitude_i=%i\n", lastGpsLatitude, lastGpsLongitude); LOG_DEBUG("--------SMART POSITION-----------------------------------\n"); - LOG_DEBUG("hasTraveledOverThreshold=%i, distanceTraveled=%d, distanceThreshold=% u\n", + LOG_DEBUG("hasTraveledOverThreshold=%i, distanceTraveled=%f, distanceThreshold=%f\n", abs(distanceTraveledSinceLastSend) >= distanceTravelThreshold, abs(distanceTraveledSinceLastSend), distanceTravelThreshold); From f7758b4e4401640c55d320d60fffc30ecc0868da Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 21:32:49 -0600 Subject: [PATCH 5/5] [create-pull-request] automated change (#3298) Co-authored-by: thebentern --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index ed7e93154..14d1884fb 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 2 minor = 2 -build = 24 +build = 25