Merge remote-tracking branch 'origin/dev'
This commit is contained in:
commit
0335245362
11 files changed
+206
-4
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <MeshCore.h>
|
||||
#include <helpers/KeyValueStore.h>
|
||||
|
||||
// from https://github.com/RAKWireless/RAK11300-AT-Command-Firmware/blob/9c48409a43620a828d653501d536473200aa33af/RAK11300-AT-Arduino/batt.cpp#L17-L19
|
||||
#define VBAT_MV_PER_LSB (0.806F) // 3.0V ADC range and 12 - bit ADC resolution = 3300mV / 4096
|
||||
@@ -46,4 +47,6 @@ public:
|
||||
void reboot() override { rp2040.reboot(); }
|
||||
|
||||
bool startOTAUpdate(const char *id, char reply[]) override;
|
||||
|
||||
void attachDynamicPrefs(KeyValueStore* prefs) { } // no-op
|
||||
};
|
||||
@@ -15,6 +15,9 @@ void ThinkNodeM6Board::begin() {
|
||||
digitalWrite(P_LORA_TX_LED, LOW);
|
||||
#endif
|
||||
|
||||
pinMode(EXT_PWR_DETECT, INPUT);
|
||||
pinMode(EXT_CHRG_DETECT, INPUT);
|
||||
|
||||
delay(10); // give sx1262 some time to power up
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,35 @@ public:
|
||||
return "Elecrow ThinkNode M6";
|
||||
}
|
||||
|
||||
bool hasUsbPowerDetect() const override { return true; }
|
||||
|
||||
bool isUsbPowered() override {
|
||||
// P0.13 is the dedicated USB / external power-detect line on the M6 PCB
|
||||
// (same pin the Meshtastic M6 variant uses for USB detection).
|
||||
return digitalRead(EXT_PWR_DETECT) == EXT_PWR_DETECT_VALUE;
|
||||
}
|
||||
|
||||
bool hasSolarChargerDetect() const override { return true; }
|
||||
|
||||
bool isSolarChargerActive() override {
|
||||
// P0.15 is the active-low solar-charger status line. It reports the
|
||||
// charger's state, not photovoltaic voltage or current.
|
||||
return digitalRead(EXT_CHRG_DETECT) == EXT_CHRG_DETECT_VALUE;
|
||||
}
|
||||
|
||||
bool isExternalPowered() override {
|
||||
if (isUsbPowered() || isSolarChargerActive()) {
|
||||
return true;
|
||||
}
|
||||
return NRF52Board::isExternalPowered();
|
||||
}
|
||||
|
||||
bool isChargerActive() override {
|
||||
// Preserve a generic charging indication while also exposing both
|
||||
// source-specific states (USB / solar) separately through the CLI.
|
||||
return isSolarChargerActive() || isUsbPowered();
|
||||
}
|
||||
|
||||
void powerOff() override {
|
||||
|
||||
// turn off all leds, sd_power_system_off will not do this for us
|
||||
|
||||
@@ -29,6 +29,12 @@
|
||||
|
||||
#define AREF_VOLTAGE (3.0)
|
||||
|
||||
// External power and charger status lines.
|
||||
#define EXT_PWR_DETECT (13)
|
||||
#define EXT_PWR_DETECT_VALUE HIGH
|
||||
#define EXT_CHRG_DETECT (15)
|
||||
#define EXT_CHRG_DETECT_VALUE LOW
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Number of pins
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ build_flags = ${WioTrackerL1-1W.build_flags}
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D DISPLAY_CLASS=SH1106Display
|
||||
-D UI_HAS_JOYSTICK=1
|
||||
-D UI_NO_HIBERNATE
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D PIN_BUZZER=12
|
||||
-D QSPIFLASH=1
|
||||
@@ -96,6 +97,7 @@ build_flags = ${WioTrackerL1-1W.build_flags}
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D DISPLAY_CLASS=SH1106Display
|
||||
-D UI_HAS_JOYSTICK=1
|
||||
-D UI_NO_HIBERNATE
|
||||
-D PIN_BUZZER=12
|
||||
-D QSPIFLASH=1
|
||||
-D RADIO_FEM_TXGAIN=1
|
||||
|
||||
Reference in new issue
Block a user