Compare commits
32 Commits
v1.14.0-ev
...
v1.14.0-ev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9f4b4abd2 | ||
|
|
4326069ba2 | ||
|
|
97aaa51cf3 | ||
|
|
8d0a4b944c | ||
|
|
6b781b1e9c | ||
|
|
c8e003f88d | ||
|
|
88f2e35faa | ||
|
|
5ac8ab2a62 | ||
|
|
5188221584 | ||
|
|
76524c703f | ||
|
|
29be7e293c | ||
|
|
aad56bb334 | ||
|
|
5dddb8a3a1 | ||
|
|
2a6325d8f8 | ||
|
|
bd47d8d86b | ||
|
|
ca476488bb | ||
|
|
7a8370fa69 | ||
|
|
cdca79540f | ||
|
|
14db7d43cc | ||
|
|
60b76f56d9 | ||
|
|
801ed6bb0a | ||
|
|
67d22401b1 | ||
|
|
10f2fecd45 | ||
|
|
0d87dcc989 | ||
|
|
c7568a8db0 | ||
|
|
c436bd42c5 | ||
|
|
0a66dee990 | ||
|
|
5120f9927a | ||
|
|
46012f89e7 | ||
|
|
0084d92239 | ||
|
|
119b8f29e6 | ||
|
|
52de2096ab |
@@ -2,6 +2,7 @@
|
|||||||
"name": "MeshCore",
|
"name": "MeshCore",
|
||||||
"image": "mcr.microsoft.com/devcontainers/python:3-bookworm",
|
"image": "mcr.microsoft.com/devcontainers/python:3-bookworm",
|
||||||
"features": {
|
"features": {
|
||||||
|
"ghcr.io/devcontainers-extra/features/bun:1": {},
|
||||||
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
|
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
|
||||||
"packages": [
|
"packages": [
|
||||||
"sudo"
|
"sudo"
|
||||||
@@ -11,14 +12,15 @@
|
|||||||
"runArgs": [
|
"runArgs": [
|
||||||
"--privileged",
|
"--privileged",
|
||||||
"--network=host",
|
"--network=host",
|
||||||
"--volume=/dev/bus/usb:/dev/bus/usb:ro",
|
"--device=/dev/bus/usb",
|
||||||
// arch tty* is owned by uucp (986)
|
// arch linux tty* is owned by uucp (986)
|
||||||
|
"--group-add=986",
|
||||||
// debian tty* is owned by dialout (20)
|
// debian tty* is owned by dialout (20)
|
||||||
"--group-add=20",
|
"--group-add=20"
|
||||||
"--group-add=986"
|
|
||||||
],
|
],
|
||||||
"postCreateCommand": {
|
"postCreateCommand": {
|
||||||
"platformio": "pipx install platformio"
|
"platformio": "pipx install platformio",
|
||||||
|
"opencode": "curl -fsSL https://opencode.ai/install | bash"
|
||||||
},
|
},
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
"frameworks": ["arduino"],
|
"frameworks": ["arduino"],
|
||||||
"name": "Heltec nrf (Adafruit BSP)",
|
"name": "Heltec nrf (Adafruit BSP)",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 815104,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
],
|
],
|
||||||
"name": "Heltec Mesh Solar Board",
|
"name": "Heltec Mesh Solar Board",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 815104,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
],
|
],
|
||||||
"name": "Heltec T114 Board",
|
"name": "Heltec T114 Board",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 815104,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
],
|
],
|
||||||
"name": "Keepteen LT1",
|
"name": "Keepteen LT1",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 815104,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
],
|
],
|
||||||
"name": "Meshtiny",
|
"name": "Meshtiny",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 815104,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
|
|||||||
@@ -38,8 +38,8 @@
|
|||||||
"frameworks": ["arduino"],
|
"frameworks": ["arduino"],
|
||||||
"name": "Minewsemi ME25LS01",
|
"name": "Minewsemi ME25LS01",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 811008,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
"protocols": [
|
"protocols": [
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
],
|
],
|
||||||
"name": "BQ nRF52840",
|
"name": "BQ nRF52840",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 815104,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
],
|
],
|
||||||
"name": "ProMicro NRF52840",
|
"name": "ProMicro NRF52840",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 815104,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
],
|
],
|
||||||
"name": "WisCore RAK3401 Board",
|
"name": "WisCore RAK3401 Board",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 815104,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
],
|
],
|
||||||
"name": "WisCore RAK4631 Board",
|
"name": "WisCore RAK4631 Board",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 815104,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
],
|
],
|
||||||
"name": "Seeed Wio Tracker L1",
|
"name": "Seeed Wio Tracker L1",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 237568,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 811008,
|
"maximum_size": 811008,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
],
|
],
|
||||||
"name": "Seeed Studio XIAO nRF52840",
|
"name": "Seeed Studio XIAO nRF52840",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 237568,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 811008,
|
"maximum_size": 811008,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
|
|||||||
@@ -39,8 +39,8 @@
|
|||||||
],
|
],
|
||||||
"name": "Seeed Studio XIAO nRF52840",
|
"name": "Seeed Studio XIAO nRF52840",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 811008,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"protocols": [
|
"protocols": [
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
],
|
],
|
||||||
"name": "LilyGo T-ECHO",
|
"name": "LilyGo T-ECHO",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 815104,
|
||||||
"require_upload_port": true,
|
"require_upload_port": true,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
],
|
],
|
||||||
"name": "elecrow eink",
|
"name": "elecrow eink",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 815104,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"use_1200bps_touch": true,
|
"use_1200bps_touch": true,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
],
|
],
|
||||||
"name": "elecrow nrf",
|
"name": "elecrow nrf",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 815104,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"use_1200bps_touch": true,
|
"use_1200bps_touch": true,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
],
|
],
|
||||||
"name": "elecrow solar",
|
"name": "elecrow solar",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 815104,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"use_1200bps_touch": true,
|
"use_1200bps_touch": true,
|
||||||
|
|||||||
@@ -38,8 +38,8 @@
|
|||||||
"frameworks": ["arduino"],
|
"frameworks": ["arduino"],
|
||||||
"name": "Seeed T1000-E",
|
"name": "Seeed T1000-E",
|
||||||
"upload": {
|
"upload": {
|
||||||
"maximum_ram_size": 248832,
|
"maximum_ram_size": 235520,
|
||||||
"maximum_size": 815104,
|
"maximum_size": 811008,
|
||||||
"speed": 115200,
|
"speed": 115200,
|
||||||
"protocol": "nrfutil",
|
"protocol": "nrfutil",
|
||||||
"protocols": [
|
"protocols": [
|
||||||
|
|||||||
@@ -1716,7 +1716,7 @@ void MyMesh::handleCmdFrame(size_t len) {
|
|||||||
out_frame[i++] = STATS_TYPE_CORE;
|
out_frame[i++] = STATS_TYPE_CORE;
|
||||||
uint16_t battery_mv = board.getBattMilliVolts();
|
uint16_t battery_mv = board.getBattMilliVolts();
|
||||||
uint32_t uptime_secs = _ms->getMillis() / 1000;
|
uint32_t uptime_secs = _ms->getMillis() / 1000;
|
||||||
uint8_t queue_len = (uint8_t)_mgr->getOutboundCount(0xFFFFFFFF);
|
uint8_t queue_len = (uint8_t)_mgr->getOutboundTotal();
|
||||||
memcpy(&out_frame[i], &battery_mv, 2); i += 2;
|
memcpy(&out_frame[i], &battery_mv, 2); i += 2;
|
||||||
memcpy(&out_frame[i], &uptime_secs, 4); i += 4;
|
memcpy(&out_frame[i], &uptime_secs, 4); i += 4;
|
||||||
memcpy(&out_frame[i], &_err_flags, 2); i += 2;
|
memcpy(&out_frame[i], &_err_flags, 2); i += 2;
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t
|
|||||||
if (payload[0] == REQ_TYPE_GET_STATUS) { // guests can also access this now
|
if (payload[0] == REQ_TYPE_GET_STATUS) { // guests can also access this now
|
||||||
RepeaterStats stats;
|
RepeaterStats stats;
|
||||||
stats.batt_milli_volts = board.getBattMilliVolts();
|
stats.batt_milli_volts = board.getBattMilliVolts();
|
||||||
stats.curr_tx_queue_len = _mgr->getOutboundCount(0xFFFFFFFF);
|
stats.curr_tx_queue_len = _mgr->getOutboundTotal();
|
||||||
stats.noise_floor = (int16_t)_radio->getNoiseFloor();
|
stats.noise_floor = (int16_t)_radio->getNoiseFloor();
|
||||||
stats.last_rssi = (int16_t)radio_driver.getLastRSSI();
|
stats.last_rssi = (int16_t)radio_driver.getLastRSSI();
|
||||||
stats.n_packets_recv = radio_driver.getPacketsRecv();
|
stats.n_packets_recv = radio_driver.getPacketsRecv();
|
||||||
@@ -1334,5 +1334,5 @@ bool MyMesh::hasPendingWork() const {
|
|||||||
#if defined(WITH_BRIDGE)
|
#if defined(WITH_BRIDGE)
|
||||||
if (bridge.isRunning()) return true; // bridge needs WiFi radio, can't sleep
|
if (bridge.isRunning()) return true; // bridge needs WiFi radio, can't sleep
|
||||||
#endif
|
#endif
|
||||||
return _mgr->getOutboundCount(0xFFFFFFFF) > 0;
|
return _mgr->getOutboundTotal() > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t
|
|||||||
if (payload[0] == REQ_TYPE_GET_STATUS) {
|
if (payload[0] == REQ_TYPE_GET_STATUS) {
|
||||||
ServerStats stats;
|
ServerStats stats;
|
||||||
stats.batt_milli_volts = board.getBattMilliVolts();
|
stats.batt_milli_volts = board.getBattMilliVolts();
|
||||||
stats.curr_tx_queue_len = _mgr->getOutboundCount(0xFFFFFFFF);
|
stats.curr_tx_queue_len = _mgr->getOutboundTotal();
|
||||||
stats.noise_floor = (int16_t)_radio->getNoiseFloor();
|
stats.noise_floor = (int16_t)_radio->getNoiseFloor();
|
||||||
stats.last_rssi = (int16_t)radio_driver.getLastRSSI();
|
stats.last_rssi = (int16_t)radio_driver.getLastRSSI();
|
||||||
stats.n_packets_recv = radio_driver.getPacketsRecv();
|
stats.n_packets_recv = radio_driver.getPacketsRecv();
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public:
|
|||||||
virtual void queueOutbound(Packet* packet, uint8_t priority, uint32_t scheduled_for) = 0;
|
virtual void queueOutbound(Packet* packet, uint8_t priority, uint32_t scheduled_for) = 0;
|
||||||
virtual Packet* getNextOutbound(uint32_t now) = 0; // by priority
|
virtual Packet* getNextOutbound(uint32_t now) = 0; // by priority
|
||||||
virtual int getOutboundCount(uint32_t now) const = 0;
|
virtual int getOutboundCount(uint32_t now) const = 0;
|
||||||
|
virtual int getOutboundTotal() const = 0;
|
||||||
virtual int getFreeCount() const = 0;
|
virtual int getFreeCount() const = 0;
|
||||||
virtual Packet* getOutboundByIdx(int i) = 0;
|
virtual Packet* getOutboundByIdx(int i) = 0;
|
||||||
virtual Packet* removeOutboundByIdx(int i) = 0;
|
virtual Packet* removeOutboundByIdx(int i) = 0;
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ PacketQueue::PacketQueue(int max_entries) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int PacketQueue::countBefore(uint32_t now) const {
|
int PacketQueue::countBefore(uint32_t now) const {
|
||||||
|
if (now == 0xFFFFFFFF) return _num; // sentinel: count all entries regardless of schedule
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (int j = 0; j < _num; j++) {
|
for (int j = 0; j < _num; j++) {
|
||||||
if ((int32_t)(_schedule_table[j] - now) > 0) continue; // scheduled for future... ignore for now
|
if ((int32_t)(_schedule_table[j] - now) > 0) continue; // scheduled for future... ignore for now
|
||||||
@@ -97,6 +99,10 @@ int StaticPoolPacketManager::getOutboundCount(uint32_t now) const {
|
|||||||
return send_queue.countBefore(now);
|
return send_queue.countBefore(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int StaticPoolPacketManager::getOutboundTotal() const {
|
||||||
|
return send_queue.count();
|
||||||
|
}
|
||||||
|
|
||||||
int StaticPoolPacketManager::getFreeCount() const {
|
int StaticPoolPacketManager::getFreeCount() const {
|
||||||
return unused.count();
|
return unused.count();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public:
|
|||||||
void queueOutbound(mesh::Packet* packet, uint8_t priority, uint32_t scheduled_for) override;
|
void queueOutbound(mesh::Packet* packet, uint8_t priority, uint32_t scheduled_for) override;
|
||||||
mesh::Packet* getNextOutbound(uint32_t now) override;
|
mesh::Packet* getNextOutbound(uint32_t now) override;
|
||||||
int getOutboundCount(uint32_t now) const override;
|
int getOutboundCount(uint32_t now) const override;
|
||||||
|
int getOutboundTotal() const override;
|
||||||
int getFreeCount() const override;
|
int getFreeCount() const override;
|
||||||
mesh::Packet* getOutboundByIdx(int i) override;
|
mesh::Packet* getOutboundByIdx(int i) override;
|
||||||
mesh::Packet* removeOutboundByIdx(int i) override;
|
mesh::Packet* removeOutboundByIdx(int i) override;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public:
|
|||||||
board.getBattMilliVolts(),
|
board.getBattMilliVolts(),
|
||||||
ms.getMillis() / 1000,
|
ms.getMillis() / 1000,
|
||||||
err_flags,
|
err_flags,
|
||||||
mgr->getOutboundCount(0xFFFFFFFF)
|
mgr->getOutboundTotal()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,10 +39,13 @@ class MicroNMEALocationProvider : public LocationProvider {
|
|||||||
mesh::RTCClock* _clock;
|
mesh::RTCClock* _clock;
|
||||||
Stream* _gps_serial;
|
Stream* _gps_serial;
|
||||||
RefCountedDigitalPin* _peripher_power;
|
RefCountedDigitalPin* _peripher_power;
|
||||||
|
int8_t _claims = 0;
|
||||||
int _pin_reset;
|
int _pin_reset;
|
||||||
int _pin_en;
|
int _pin_en;
|
||||||
long next_check = 0;
|
long next_check = 0;
|
||||||
long time_valid = 0;
|
long time_valid = 0;
|
||||||
|
unsigned long _last_time_sync = 0;
|
||||||
|
static const unsigned long TIME_SYNC_INTERVAL = 1800000; // Re-sync every 30 minutes
|
||||||
|
|
||||||
public :
|
public :
|
||||||
MicroNMEALocationProvider(Stream& ser, mesh::RTCClock* clock = NULL, int pin_reset = GPS_RESET, int pin_en = GPS_EN,RefCountedDigitalPin* peripher_power=NULL) :
|
MicroNMEALocationProvider(Stream& ser, mesh::RTCClock* clock = NULL, int pin_reset = GPS_RESET, int pin_en = GPS_EN,RefCountedDigitalPin* peripher_power=NULL) :
|
||||||
@@ -57,8 +60,21 @@ public :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void claim() {
|
||||||
|
_claims++;
|
||||||
|
if (_claims > 0) {
|
||||||
|
if (_peripher_power) _peripher_power->claim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void release() {
|
||||||
|
if (_claims == 0) return; // avoid negative _claims
|
||||||
|
_claims--;
|
||||||
|
if (_peripher_power) _peripher_power->release();
|
||||||
|
}
|
||||||
|
|
||||||
void begin() override {
|
void begin() override {
|
||||||
if (_peripher_power) _peripher_power->claim();
|
claim();
|
||||||
if (_pin_en != -1) {
|
if (_pin_en != -1) {
|
||||||
digitalWrite(_pin_en, PIN_GPS_EN_ACTIVE);
|
digitalWrite(_pin_en, PIN_GPS_EN_ACTIVE);
|
||||||
}
|
}
|
||||||
@@ -82,7 +98,7 @@ public :
|
|||||||
if (_pin_reset != -1) {
|
if (_pin_reset != -1) {
|
||||||
digitalWrite(_pin_reset, GPS_RESET_FORCE);
|
digitalWrite(_pin_reset, GPS_RESET_FORCE);
|
||||||
}
|
}
|
||||||
if (_peripher_power) _peripher_power->release();
|
release();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isEnabled() override {
|
bool isEnabled() override {
|
||||||
@@ -129,10 +145,15 @@ public :
|
|||||||
|
|
||||||
if (millis() > next_check) {
|
if (millis() > next_check) {
|
||||||
next_check = millis() + 1000;
|
next_check = millis() + 1000;
|
||||||
|
// Re-enable time sync periodically when GPS has valid fix
|
||||||
|
if (!_time_sync_needed && _clock != NULL && (millis() - _last_time_sync) > TIME_SYNC_INTERVAL) {
|
||||||
|
_time_sync_needed = true;
|
||||||
|
}
|
||||||
if (_time_sync_needed && time_valid > 2) {
|
if (_time_sync_needed && time_valid > 2) {
|
||||||
if (_clock != NULL) {
|
if (_clock != NULL) {
|
||||||
_clock->setCurrentTime(getTimestamp());
|
_clock->setCurrentTime(getTimestamp());
|
||||||
_time_sync_needed = false;
|
_time_sync_needed = false;
|
||||||
|
_last_time_sync = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isValid()) {
|
if (isValid()) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ WRAPPER_CLASS radio_driver(radio, board);
|
|||||||
|
|
||||||
VolatileRTCClock fallback_clock;
|
VolatileRTCClock fallback_clock;
|
||||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
SolarSensorManager sensors = SolarSensorManager(nmea);
|
SolarSensorManager sensors = SolarSensorManager(nmea);
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
// Power management boot protection threshold (millivolts)
|
// Power management boot protection threshold (millivolts)
|
||||||
// Set to 0 to disable boot protection
|
// Set to 0 to disable boot protection
|
||||||
#define PWRMGT_VOLTAGE_BOOTLOCK 3300 // Won't boot below this voltage (mV)
|
#define PWRMGT_VOLTAGE_BOOTLOCK 0 // Won't boot below this voltage (mV)
|
||||||
// LPCOMP wake configuration (voltage recovery from SYSTEMOFF)
|
// LPCOMP wake configuration (voltage recovery from SYSTEMOFF)
|
||||||
// AIN2 = P0.04 = BATTERY_PIN / PIN_VBAT_READ
|
// AIN2 = P0.04 = BATTERY_PIN / PIN_VBAT_READ
|
||||||
#define PWRMGT_LPCOMP_AIN 2
|
#define PWRMGT_LPCOMP_AIN 2
|
||||||
|
|||||||
@@ -6,19 +6,7 @@ void HeltecTrackerV2Board::begin() {
|
|||||||
pinMode(PIN_ADC_CTRL, OUTPUT);
|
pinMode(PIN_ADC_CTRL, OUTPUT);
|
||||||
digitalWrite(PIN_ADC_CTRL, LOW); // Initially inactive
|
digitalWrite(PIN_ADC_CTRL, LOW); // Initially inactive
|
||||||
|
|
||||||
// Set up digital GPIO registers before releasing RTC hold. The hold latches
|
loRaFEMControl.init();
|
||||||
// the pad state including function select, so register writes accumulate
|
|
||||||
// without affecting the pad. On hold release, all changes apply atomically
|
|
||||||
// (IO MUX switches to digital GPIO with output already HIGH — no glitch).
|
|
||||||
pinMode(P_LORA_PA_POWER, OUTPUT);
|
|
||||||
digitalWrite(P_LORA_PA_POWER,HIGH);
|
|
||||||
rtc_gpio_hold_dis((gpio_num_t)P_LORA_PA_POWER);
|
|
||||||
|
|
||||||
pinMode(P_LORA_PA_EN, OUTPUT);
|
|
||||||
digitalWrite(P_LORA_PA_EN,HIGH);
|
|
||||||
rtc_gpio_hold_dis((gpio_num_t)P_LORA_PA_EN);
|
|
||||||
pinMode(P_LORA_PA_TX_EN, OUTPUT);
|
|
||||||
digitalWrite(P_LORA_PA_TX_EN,LOW);
|
|
||||||
|
|
||||||
esp_reset_reason_t reason = esp_reset_reason();
|
esp_reset_reason_t reason = esp_reset_reason();
|
||||||
if (reason != ESP_RST_DEEPSLEEP) {
|
if (reason != ESP_RST_DEEPSLEEP) {
|
||||||
@@ -39,12 +27,12 @@ void HeltecTrackerV2Board::begin() {
|
|||||||
|
|
||||||
void HeltecTrackerV2Board::onBeforeTransmit(void) {
|
void HeltecTrackerV2Board::onBeforeTransmit(void) {
|
||||||
digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on
|
digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on
|
||||||
digitalWrite(P_LORA_PA_TX_EN,HIGH);
|
loRaFEMControl.setTxModeEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeltecTrackerV2Board::onAfterTransmit(void) {
|
void HeltecTrackerV2Board::onAfterTransmit(void) {
|
||||||
digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off
|
digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off
|
||||||
digitalWrite(P_LORA_PA_TX_EN,LOW);
|
loRaFEMControl.setRxModeEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeltecTrackerV2Board::enterDeepSleep(uint32_t secs, int pin_wake_btn) {
|
void HeltecTrackerV2Board::enterDeepSleep(uint32_t secs, int pin_wake_btn) {
|
||||||
@@ -56,9 +44,7 @@ void HeltecTrackerV2Board::begin() {
|
|||||||
|
|
||||||
rtc_gpio_hold_en((gpio_num_t)P_LORA_NSS);
|
rtc_gpio_hold_en((gpio_num_t)P_LORA_NSS);
|
||||||
|
|
||||||
// Hold GC1109 FEM pins during sleep to keep LNA active for RX wake
|
loRaFEMControl.setRxModeEnableWhenMCUSleep();//It also needs to be enabled in receive mode
|
||||||
rtc_gpio_hold_en((gpio_num_t)P_LORA_PA_POWER);
|
|
||||||
rtc_gpio_hold_en((gpio_num_t)P_LORA_PA_EN);
|
|
||||||
|
|
||||||
if (pin_wake_btn < 0) {
|
if (pin_wake_btn < 0) {
|
||||||
esp_sleep_enable_ext1_wakeup( (1L << P_LORA_DIO_1), ESP_EXT1_WAKEUP_ANY_HIGH); // wake up on: recv LoRa packet
|
esp_sleep_enable_ext1_wakeup( (1L << P_LORA_DIO_1), ESP_EXT1_WAKEUP_ANY_HIGH); // wake up on: recv LoRa packet
|
||||||
|
|||||||
@@ -4,11 +4,13 @@
|
|||||||
#include <helpers/RefCountedDigitalPin.h>
|
#include <helpers/RefCountedDigitalPin.h>
|
||||||
#include <helpers/ESP32Board.h>
|
#include <helpers/ESP32Board.h>
|
||||||
#include <driver/rtc_io.h>
|
#include <driver/rtc_io.h>
|
||||||
|
#include "LoRaFEMControl.h"
|
||||||
|
|
||||||
class HeltecTrackerV2Board : public ESP32Board {
|
class HeltecTrackerV2Board : public ESP32Board {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RefCountedDigitalPin periph_power;
|
RefCountedDigitalPin periph_power;
|
||||||
|
LoRaFEMControl loRaFEMControl;
|
||||||
|
|
||||||
HeltecTrackerV2Board() : periph_power(PIN_VEXT_EN,PIN_VEXT_EN_ACTIVE) { }
|
HeltecTrackerV2Board() : periph_power(PIN_VEXT_EN,PIN_VEXT_EN_ACTIVE) { }
|
||||||
|
|
||||||
|
|||||||
58
variants/heltec_tracker_v2/LoRaFEMControl.cpp
Normal file
58
variants/heltec_tracker_v2/LoRaFEMControl.cpp
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
#include "LoRaFEMControl.h"
|
||||||
|
#include <driver/rtc_io.h>
|
||||||
|
#include <esp_sleep.h>
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
void LoRaFEMControl::init(void)
|
||||||
|
{
|
||||||
|
pinMode(P_LORA_PA_POWER, OUTPUT);
|
||||||
|
digitalWrite(P_LORA_PA_POWER, HIGH);
|
||||||
|
rtc_gpio_hold_dis((gpio_num_t)P_LORA_PA_POWER);
|
||||||
|
rtc_gpio_hold_dis((gpio_num_t)P_LORA_KCT8103L_PA_CSD);
|
||||||
|
rtc_gpio_hold_dis((gpio_num_t)P_LORA_KCT8103L_PA_CTX);
|
||||||
|
delay(1);
|
||||||
|
pinMode(P_LORA_KCT8103L_PA_CSD, OUTPUT);
|
||||||
|
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH);
|
||||||
|
pinMode(P_LORA_KCT8103L_PA_CTX, OUTPUT);
|
||||||
|
digitalWrite(P_LORA_KCT8103L_PA_CTX, HIGH);
|
||||||
|
setLnaCanControl(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoRaFEMControl::setSleepModeEnable(void)
|
||||||
|
{
|
||||||
|
// shutdown the PA
|
||||||
|
digitalWrite(P_LORA_KCT8103L_PA_CSD, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoRaFEMControl::setTxModeEnable(void)
|
||||||
|
{
|
||||||
|
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH);
|
||||||
|
digitalWrite(P_LORA_KCT8103L_PA_CTX, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoRaFEMControl::setRxModeEnable(void)
|
||||||
|
{
|
||||||
|
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH);
|
||||||
|
if (lna_enabled) {
|
||||||
|
digitalWrite(P_LORA_KCT8103L_PA_CTX, LOW);
|
||||||
|
} else {
|
||||||
|
digitalWrite(P_LORA_KCT8103L_PA_CTX, HIGH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoRaFEMControl::setRxModeEnableWhenMCUSleep(void)
|
||||||
|
{
|
||||||
|
digitalWrite(P_LORA_KCT8103L_PA_CSD, HIGH);
|
||||||
|
rtc_gpio_hold_en((gpio_num_t)P_LORA_KCT8103L_PA_CSD);
|
||||||
|
if (lna_enabled) {
|
||||||
|
digitalWrite(P_LORA_KCT8103L_PA_CTX, LOW);
|
||||||
|
} else {
|
||||||
|
digitalWrite(P_LORA_KCT8103L_PA_CTX, HIGH);
|
||||||
|
}
|
||||||
|
rtc_gpio_hold_en((gpio_num_t)P_LORA_KCT8103L_PA_CTX);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoRaFEMControl::setLNAEnable(bool enabled)
|
||||||
|
{
|
||||||
|
lna_enabled = enabled;
|
||||||
|
}
|
||||||
21
variants/heltec_tracker_v2/LoRaFEMControl.h
Normal file
21
variants/heltec_tracker_v2/LoRaFEMControl.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
class LoRaFEMControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LoRaFEMControl() {}
|
||||||
|
virtual ~LoRaFEMControl() {}
|
||||||
|
void init(void);
|
||||||
|
void setSleepModeEnable(void);
|
||||||
|
void setTxModeEnable(void);
|
||||||
|
void setRxModeEnable(void);
|
||||||
|
void setRxModeEnableWhenMCUSleep(void);
|
||||||
|
void setLNAEnable(bool enabled);
|
||||||
|
bool isLnaCanControl(void) { return lna_can_control; }
|
||||||
|
void setLnaCanControl(bool can_control) { lna_can_control = can_control; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool lna_enabled = false;
|
||||||
|
bool lna_can_control = false;
|
||||||
|
};
|
||||||
@@ -17,18 +17,18 @@ build_flags =
|
|||||||
-D P_LORA_SCLK=9
|
-D P_LORA_SCLK=9
|
||||||
-D P_LORA_MISO=11
|
-D P_LORA_MISO=11
|
||||||
-D P_LORA_MOSI=10
|
-D P_LORA_MOSI=10
|
||||||
-D P_LORA_PA_POWER=7 ; VFEM_Ctrl - GC1109 LDO power enable
|
-D P_LORA_PA_POWER=7 ;VFEM_Ctrl -LDO power enable
|
||||||
-D P_LORA_PA_EN=4 ; CSD - GC1109 chip enable (HIGH=on)
|
-D P_LORA_KCT8103L_PA_CSD=4
|
||||||
-D P_LORA_PA_TX_EN=46 ; CPS - GC1109 PA mode (HIGH=full PA, LOW=bypass)
|
-D P_LORA_KCT8103L_PA_CTX=5
|
||||||
-D LORA_TX_POWER=10 ; 10dBm + ~11dB GC1109 gain = ~21dBm output
|
-D LORA_TX_POWER=9 ; 9dBm + ~13dB KCT8103L gain = ~22dBm output
|
||||||
-D MAX_LORA_TX_POWER=22 ; Max SX1262 output -> ~28dBm at antenna
|
-D MAX_LORA_TX_POWER=22 ; Max SX1262 output -> ~28dBm at antenna
|
||||||
-D SX126X_DIO2_AS_RF_SWITCH=true
|
-D SX126X_DIO2_AS_RF_SWITCH=true
|
||||||
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
|
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
|
||||||
-D SX126X_CURRENT_LIMIT=140
|
-D SX126X_CURRENT_LIMIT=140
|
||||||
-D SX126X_RX_BOOSTED_GAIN=1
|
-D SX126X_RX_BOOSTED_GAIN=1
|
||||||
-D SX126X_REGISTER_PATCH=1
|
-D SX126X_REGISTER_PATCH=1
|
||||||
-D PIN_BOARD_SDA=5
|
-D PIN_BOARD_SDA=6
|
||||||
-D PIN_BOARD_SCL=6
|
-D PIN_BOARD_SCL=17
|
||||||
-D PIN_USER_BTN=0
|
-D PIN_USER_BTN=0
|
||||||
-D PIN_TFT_SDA=42 ; SDIN
|
-D PIN_TFT_SDA=42 ; SDIN
|
||||||
-D PIN_TFT_SCL=41 ; SCLK
|
-D PIN_TFT_SCL=41 ; SCLK
|
||||||
@@ -207,8 +207,6 @@ build_flags =
|
|||||||
-D ADVERT_LAT=0.0
|
-D ADVERT_LAT=0.0
|
||||||
-D ADVERT_LON=0.0
|
-D ADVERT_LON=0.0
|
||||||
-D ADMIN_PASSWORD='"password"'
|
-D ADMIN_PASSWORD='"password"'
|
||||||
-D ENV_PIN_SDA=3
|
|
||||||
-D ENV_PIN_SCL=4
|
|
||||||
-D DISPLAY_CLASS=ST7735Display
|
-D DISPLAY_CLASS=ST7735Display
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||||||
|
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, NULL, GPS_RESET, GPS_EN, &board.periph_power);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock, GPS_RESET, GPS_EN, &board.periph_power);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||||||
|
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||||||
|
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ VolatileRTCClock fallback_clock;
|
|||||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||||||
|
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||||||
|
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||||||
|
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||||||
|
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ WRAPPER_CLASS radio_driver(radio, board);
|
|||||||
|
|
||||||
ESP32RTCClock fallback_clock;
|
ESP32RTCClock fallback_clock;
|
||||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
MASensorManager sensors = MASensorManager(nmea);
|
MASensorManager sensors = MASensorManager(nmea);
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ WRAPPER_CLASS radio_driver(radio, board);
|
|||||||
|
|
||||||
VolatileRTCClock fallback_clock;
|
VolatileRTCClock fallback_clock;
|
||||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
NanoG2UltraSensorManager sensors = NanoG2UltraSensorManager(nmea);
|
NanoG2UltraSensorManager sensors = NanoG2UltraSensorManager(nmea);
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ VolatileRTCClock fallback_clock;
|
|||||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||||||
|
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||||||
|
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||||||
|
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||||||
|
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ build_flags = ${nrf52_base.build_flags}
|
|||||||
-I lib/nrf52/s140_nrf52_7.3.0_API/include/nrf52
|
-I lib/nrf52/s140_nrf52_7.3.0_API/include/nrf52
|
||||||
-I variants/sensecap_solar
|
-I variants/sensecap_solar
|
||||||
-I src/helpers/nrf52
|
-I src/helpers/nrf52
|
||||||
-UENV_INCLUDE_GPS
|
|
||||||
-D NRF52_PLATFORM=1
|
-D NRF52_PLATFORM=1
|
||||||
-D RADIO_CLASS=CustomSX1262
|
-D RADIO_CLASS=CustomSX1262
|
||||||
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||||
@@ -24,6 +23,7 @@ build_flags = ${nrf52_base.build_flags}
|
|||||||
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
|
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
|
||||||
-D SX126X_CURRENT_LIMIT=140
|
-D SX126X_CURRENT_LIMIT=140
|
||||||
-D SX126X_RX_BOOSTED_GAIN=1
|
-D SX126X_RX_BOOSTED_GAIN=1
|
||||||
|
-D ENV_INCLUDE_GPS=1
|
||||||
build_src_filter = ${nrf52_base.build_src_filter}
|
build_src_filter = ${nrf52_base.build_src_filter}
|
||||||
+<helpers/*.cpp>
|
+<helpers/*.cpp>
|
||||||
+<helpers/sensors>
|
+<helpers/sensors>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include <helpers/ArduinoHelpers.h>
|
#include <helpers/ArduinoHelpers.h>
|
||||||
|
#ifdef ENV_INCLUDE_GPS
|
||||||
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
|
#endif
|
||||||
SenseCapSolarBoard board;
|
SenseCapSolarBoard board;
|
||||||
|
|
||||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
||||||
@@ -10,7 +12,12 @@ WRAPPER_CLASS radio_driver(radio, board);
|
|||||||
|
|
||||||
VolatileRTCClock fallback_clock;
|
VolatileRTCClock fallback_clock;
|
||||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
EnvironmentSensorManager sensors;
|
#ifdef ENV_INCLUDE_GPS
|
||||||
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
|
#else
|
||||||
|
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||||
|
#endif
|
||||||
|
|
||||||
bool radio_init() {
|
bool radio_init() {
|
||||||
rtc_clock.begin(Wire);
|
rtc_clock.begin(Wire);
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ const uint32_t g_ADigitalPinMap[] = {
|
|||||||
47, // D10 P1.15 (SPI_MOSI) LORA_MOSI
|
47, // D10 P1.15 (SPI_MOSI) LORA_MOSI
|
||||||
|
|
||||||
// D11-D12 - LED outputs
|
// D11-D12 - LED outputs
|
||||||
15, // D11 P0.15 User LED
|
15, // D11 P0.15 User LED (White LED)
|
||||||
19, // D12 P0.19 Breathing LED
|
19, // D12 P0.19 Breathing LED (Blue LED - LoRa TX)
|
||||||
|
|
||||||
// D13 - User input
|
// D13 - User input
|
||||||
33, // D13 P1.01 User Button
|
33, // D13 P1.01 User Button
|
||||||
@@ -58,14 +58,9 @@ void initVariant() {
|
|||||||
pinMode(PIN_QSPI_CS, OUTPUT);
|
pinMode(PIN_QSPI_CS, OUTPUT);
|
||||||
digitalWrite(PIN_QSPI_CS, HIGH);
|
digitalWrite(PIN_QSPI_CS, HIGH);
|
||||||
|
|
||||||
pinMode(LED_GREEN, OUTPUT);
|
pinMode(LED_WHITE, OUTPUT);
|
||||||
digitalWrite(LED_GREEN, LOW);
|
digitalWrite(LED_WHITE, LOW);
|
||||||
|
|
||||||
pinMode(LED_BLUE, OUTPUT);
|
pinMode(LED_BLUE, OUTPUT);
|
||||||
digitalWrite(LED_BLUE, LOW);
|
digitalWrite(LED_BLUE, LOW);
|
||||||
|
|
||||||
/* disable gps until we actually support it.
|
|
||||||
pinMode(GPS_EN, OUTPUT);
|
|
||||||
digitalWrite(GPS_EN, HIGH);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
#define LED_BUILTIN (PIN_LED)
|
#define LED_BUILTIN (PIN_LED)
|
||||||
|
|
||||||
#define LED_RED (PINS_COUNT)
|
#define LED_RED (PINS_COUNT)
|
||||||
#define LED_GREEN (12)
|
#define LED_WHITE (11)
|
||||||
#define LED_BLUE (11)
|
#define LED_BLUE (12) // LoRa TX indicator
|
||||||
|
|
||||||
#define LED_STATE_ON (1) // State when LED is litted
|
#define LED_STATE_ON (1) // State when LED is litted
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ static unsigned int ntc_res2[136] = {
|
|||||||
1081, 1053, 1026, 999, 974, 949, 925, 902, 880, 858,
|
1081, 1053, 1026, 999, 974, 949, 925, 902, 880, 858,
|
||||||
};
|
};
|
||||||
|
|
||||||
static char ntc_temp2[136] = {
|
static int8_t ntc_temp2[136] = {
|
||||||
-30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11,
|
-30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11,
|
||||||
-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ WRAPPER_CLASS radio_driver(radio, board);
|
|||||||
VolatileRTCClock fallback_clock;
|
VolatileRTCClock fallback_clock;
|
||||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
#ifdef ENV_INCLUDE_GPS
|
#ifdef ENV_INCLUDE_GPS
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
EnvironmentSensorManager sensors = EnvironmentSensorManager();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||||||
|
|
||||||
#if ENV_INCLUDE_GPS
|
#if ENV_INCLUDE_GPS
|
||||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
#else
|
#else
|
||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ static const uint8_t D10 = 10;
|
|||||||
|
|
||||||
// Power management boot protection threshold (millivolts)
|
// Power management boot protection threshold (millivolts)
|
||||||
// Set to 0 to disable boot protection
|
// Set to 0 to disable boot protection
|
||||||
#define PWRMGT_VOLTAGE_BOOTLOCK 3300 // Won't boot below this voltage
|
#define PWRMGT_VOLTAGE_BOOTLOCK 0 // Won't boot below this voltage
|
||||||
|
|
||||||
// LPCOMP wake configuration (voltage recovery from SYSTEMOFF)
|
// LPCOMP wake configuration (voltage recovery from SYSTEMOFF)
|
||||||
#define PWRMGT_LPCOMP_AIN 7 // AIN7 = P0.31 = PIN_VBAT
|
#define PWRMGT_LPCOMP_AIN 7 // AIN7 = P0.31 = PIN_VBAT
|
||||||
|
|||||||
Reference in New Issue
Block a user