From 336cdc0efef552b0020606bcbf602f8822736874 Mon Sep 17 00:00:00 2001 From: "Aaron.Lee" <32860565+Heltec-Aaron-Lee@users.noreply.github.com> Date: Sat, 2 Nov 2024 04:12:41 +0800 Subject: [PATCH 1/3] Add Heltec V3 battery read pin detect function (#5196) --- src/Power.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Power.cpp b/src/Power.cpp index 02a07e620..96399f388 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -154,9 +154,16 @@ static void adcEnable() #ifdef ADC_CTRL // enable adc voltage divider when we need to read #ifdef ADC_USE_PULLUP pinMode(ADC_CTRL, INPUT_PULLUP); +#else +#ifdef HELTEC_V3 + pinMode(ADC_CTRL,INPUT); + uint8_t adc_ctl_enable_value=!(digitalRead(ADC_CTRL)); + pinMode(ADC_CTRL, OUTPUT); + digitalWrite(ADC_CTRL, adc_ctl_enable_value); #else pinMode(ADC_CTRL, OUTPUT); digitalWrite(ADC_CTRL, ADC_CTRL_ENABLED); +#endif #endif delay(10); #endif @@ -167,10 +174,14 @@ static void adcDisable() #ifdef ADC_CTRL // disable adc voltage divider when we need to read #ifdef ADC_USE_PULLUP pinMode(ADC_CTRL, INPUT_PULLDOWN); +#else +#ifdef HELTEC_V3 + pinMode(ADC_CTRL,ANALOG); #else digitalWrite(ADC_CTRL, !ADC_CTRL_ENABLED); #endif #endif +#endif } #endif From 701421b50a34d706f378d2d5ed075865f4d39a2d Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 1 Nov 2024 15:17:25 -0500 Subject: [PATCH 2/3] Trunk fmt --- .github/workflows/main_matrix.yml | 3 ++- src/Power.cpp | 6 +++--- variants/icarus/pins_arduino.h | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 0853df19f..efdbd2637 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -245,7 +245,8 @@ jobs: if: ${{ github.event_name == 'workflow_dispatch' }} outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} - needs: [ + needs: + [ gather-artifacts, package-raspbian, package-raspbian-armv7l, diff --git a/src/Power.cpp b/src/Power.cpp index 96399f388..f8d2459bd 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -156,8 +156,8 @@ static void adcEnable() pinMode(ADC_CTRL, INPUT_PULLUP); #else #ifdef HELTEC_V3 - pinMode(ADC_CTRL,INPUT); - uint8_t adc_ctl_enable_value=!(digitalRead(ADC_CTRL)); + pinMode(ADC_CTRL, INPUT); + uint8_t adc_ctl_enable_value = !(digitalRead(ADC_CTRL)); pinMode(ADC_CTRL, OUTPUT); digitalWrite(ADC_CTRL, adc_ctl_enable_value); #else @@ -176,7 +176,7 @@ static void adcDisable() pinMode(ADC_CTRL, INPUT_PULLDOWN); #else #ifdef HELTEC_V3 - pinMode(ADC_CTRL,ANALOG); + pinMode(ADC_CTRL, ANALOG); #else digitalWrite(ADC_CTRL, !ADC_CTRL_ENABLED); #endif diff --git a/variants/icarus/pins_arduino.h b/variants/icarus/pins_arduino.h index 9837a3b34..12d72d6dd 100644 --- a/variants/icarus/pins_arduino.h +++ b/variants/icarus/pins_arduino.h @@ -19,4 +19,3 @@ static const uint8_t MOSI = 38; static const uint8_t SS = 17; #endif /* Pins_Arduino_h */ - \ No newline at end of file From cbe74009a9e5fc20048571b6259f8936c26236c0 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 1 Nov 2024 15:46:11 -0500 Subject: [PATCH 3/3] Comment out unused var to get rid of warning --- .trunk/trunk.yaml | 4 ++-- src/mesh/NodeDB.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 2fa237d31..7e77baa0b 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -8,10 +8,10 @@ plugins: uri: https://github.com/trunk-io/plugins lint: enabled: - - trufflehog@3.82.13 + - trufflehog@3.83.2 - yamllint@1.35.1 - bandit@1.7.10 - - checkov@3.2.269 + - checkov@3.2.276 - terrascan@1.19.9 - trivy@0.56.2 #- trufflehog@3.63.2-rc0 diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 6b2991958..247cbd254 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -137,11 +137,12 @@ NodeDB::NodeDB() memcpy(myNodeInfo.device_id.bytes, &device_id_start, sizeof(device_id_start)); memcpy(myNodeInfo.device_id.bytes + sizeof(device_id_start), &device_id_end, sizeof(device_id_end)); myNodeInfo.device_id.size = 16; - hasUniqueId = true; + // Uncomment below to print the device id + // hasUniqueId = true; #else // FIXME - implement for other platforms #endif - // Uncomment below to print the device id + // if (hasUniqueId) { // std::string deviceIdHex; // for (size_t i = 0; i < myNodeInfo.device_id.size; ++i) {