mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-06-27 03:01:38 +00:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ff39c6243 | |||
| dc200cf22d | |||
| 62b95b4e48 | |||
| f3d4d8cd5e | |||
| 3d4eec4a6a | |||
| b07aba7937 | |||
| 1f9bb67400 | |||
| b8f1fad654 | |||
| eb938a9b78 | |||
| 69df5c7a95 | |||
| 9c7d71b9be | |||
| 5d0ff7fe6e | |||
| 3192684582 | |||
| aa1cb1f663 | |||
| 6a63dfce1c | |||
| c2cfba4af3 | |||
| 62849ef114 | |||
| 60ea4a91bf | |||
| dd9b3b32c3 | |||
| 7c8e092457 | |||
| 099ef67348 | |||
| 04a6c7009a | |||
| 813d108c7a | |||
| 4f9a091671 | |||
| e7db7c5a94 | |||
| 29f0a7fc4f | |||
| 1c4c995a41 | |||
| d2d3d44c9b | |||
| fe56d01da2 | |||
| 190dbb5293 | |||
| 4bf391f5c3 | |||
| 00d445a269 | |||
| f29cae602f | |||
| 3a546a6395 |
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"ldscript": "nrf52840_s140_v6.ld"
|
||||||
|
},
|
||||||
|
"core": "nRF5",
|
||||||
|
"cpu": "cortex-m4",
|
||||||
|
"extra_flags": "-DNRF52840_XXAA",
|
||||||
|
"f_cpu": "64000000L",
|
||||||
|
"hwids": [
|
||||||
|
["0x239A","0x4405"],
|
||||||
|
["0x239A","0x0029"],
|
||||||
|
["0x239A","0x002A"],
|
||||||
|
["0x239A","0x0071"]
|
||||||
|
],
|
||||||
|
"usb_product": "HT-n5262",
|
||||||
|
"mcu": "nrf52840",
|
||||||
|
"variant": "heltec_tower_v2",
|
||||||
|
"bsp": {
|
||||||
|
"name": "adafruit"
|
||||||
|
},
|
||||||
|
"softdevice": {
|
||||||
|
"sd_flags": "-DS140",
|
||||||
|
"sd_name": "s140",
|
||||||
|
"sd_version": "6.1.1",
|
||||||
|
"sd_fwid": "0x00B6"
|
||||||
|
},
|
||||||
|
"bootloader": {
|
||||||
|
"settings_addr": "0xFF000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"connectivity": [
|
||||||
|
"bluetooth"
|
||||||
|
],
|
||||||
|
"debug": {
|
||||||
|
"jlink_device": "nRF52840_xxAA",
|
||||||
|
"svd_path": "nrf52840.svd",
|
||||||
|
"openocd_target": "nrf52.cfg"
|
||||||
|
},
|
||||||
|
"frameworks": [
|
||||||
|
"arduino"
|
||||||
|
],
|
||||||
|
"name": "Heltec Tower V2 Board",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 235520,
|
||||||
|
"maximum_size": 815104,
|
||||||
|
"speed": 115200,
|
||||||
|
"protocol": "nrfutil",
|
||||||
|
"protocols": [
|
||||||
|
"jlink",
|
||||||
|
"nrfjprog",
|
||||||
|
"nrfutil",
|
||||||
|
"stlink"
|
||||||
|
],
|
||||||
|
"use_1200bps_touch": true,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"wait_for_upload_port": true
|
||||||
|
},
|
||||||
|
"url": "https://heltec.org/",
|
||||||
|
"vendor": "Heltec"
|
||||||
|
}
|
||||||
@@ -578,6 +578,20 @@ This document provides an overview of CLI commands that can be sent to MeshCore
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
#### Enable or disable hardware Channel Activity Detection (CAD)
|
||||||
|
**Usage:**
|
||||||
|
- `get cad`
|
||||||
|
- `set cad <on|off>`
|
||||||
|
|
||||||
|
**Description:** When enabled, the radio performs a hardware Channel Activity Detection scan before transmitting and defers if the channel is busy. Runs independently of `int.thresh` — either, both, or none may be active.
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
- `on|off`: Enable or disable hardware CAD
|
||||||
|
|
||||||
|
**Default:** `off`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
#### View or change the AGC Reset Interval
|
#### View or change the AGC Reset Interval
|
||||||
**Usage:**
|
**Usage:**
|
||||||
- `get agc.reset.interval`
|
- `get agc.reset.interval`
|
||||||
|
|||||||
@@ -545,7 +545,7 @@ bool DataStore::putBlobByKey(const uint8_t key[], int key_len, const uint8_t src
|
|||||||
uint32_t pos = 0, found_pos = 0;
|
uint32_t pos = 0, found_pos = 0;
|
||||||
uint32_t min_timestamp = 0xFFFFFFFF;
|
uint32_t min_timestamp = 0xFFFFFFFF;
|
||||||
|
|
||||||
// search for matching key OR evict by oldest timestmap
|
// search for matching key OR evict by oldest timestamp
|
||||||
BlobRec tmp;
|
BlobRec tmp;
|
||||||
file.seek(0);
|
file.seek(0);
|
||||||
while (file.read((uint8_t *) &tmp, sizeof(tmp)) == sizeof(tmp)) {
|
while (file.read((uint8_t *) &tmp, sizeof(tmp)) == sizeof(tmp)) {
|
||||||
|
|||||||
@@ -261,6 +261,9 @@ float MyMesh::getAirtimeBudgetFactor() const {
|
|||||||
int MyMesh::getInterferenceThreshold() const {
|
int MyMesh::getInterferenceThreshold() const {
|
||||||
return 0; // disabled for now, until currentRSSI() problem is resolved
|
return 0; // disabled for now, until currentRSSI() problem is resolved
|
||||||
}
|
}
|
||||||
|
bool MyMesh::getCADEnabled() const {
|
||||||
|
return true; // hardware CAD before TX (no CLI toggle on companion; enabled by default)
|
||||||
|
}
|
||||||
|
|
||||||
int MyMesh::calcRxDelay(float score, uint32_t air_time) const {
|
int MyMesh::calcRxDelay(float score, uint32_t air_time) const {
|
||||||
if (_prefs.rx_delay_base <= 0.0f) return 0;
|
if (_prefs.rx_delay_base <= 0.0f) return 0;
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
float getAirtimeBudgetFactor() const override;
|
float getAirtimeBudgetFactor() const override;
|
||||||
int getInterferenceThreshold() const override;
|
int getInterferenceThreshold() const override;
|
||||||
|
bool getCADEnabled() const override;
|
||||||
int calcRxDelay(float score, uint32_t air_time) const override;
|
int calcRxDelay(float score, uint32_t air_time) const override;
|
||||||
uint32_t getRetransmitDelay(const mesh::Packet *packet) override;
|
uint32_t getRetransmitDelay(const mesh::Packet *packet) override;
|
||||||
uint32_t getDirectRetransmitDelay(const mesh::Packet *packet) override;
|
uint32_t getDirectRetransmitDelay(const mesh::Packet *packet) override;
|
||||||
|
|||||||
@@ -893,6 +893,7 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
|
|||||||
_prefs.flood_max_unscoped = 64;
|
_prefs.flood_max_unscoped = 64;
|
||||||
_prefs.flood_max_advert = 8;
|
_prefs.flood_max_advert = 8;
|
||||||
_prefs.interference_threshold = 0; // disabled
|
_prefs.interference_threshold = 0; // disabled
|
||||||
|
_prefs.cad_enabled = 0; // hardware CAD before TX (off by default; 'set cad on')
|
||||||
|
|
||||||
// bridge defaults
|
// bridge defaults
|
||||||
_prefs.bridge_enabled = 1; // enabled
|
_prefs.bridge_enabled = 1; // enabled
|
||||||
@@ -1061,11 +1062,9 @@ void MyMesh::setTxPower(int8_t power_dbm) {
|
|||||||
radio_driver.setTxPower(power_dbm);
|
radio_driver.setTxPower(power_dbm);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_SX1262) || defined(USE_SX1268)
|
bool MyMesh::setRxBoostedGain(bool enable) {
|
||||||
void MyMesh::setRxBoostedGain(bool enable) {
|
return radio_driver.setRxBoostedGainMode(enable);
|
||||||
radio_driver.setRxBoostedGainMode(enable);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void MyMesh::formatNeighborsReply(char *reply) {
|
void MyMesh::formatNeighborsReply(char *reply) {
|
||||||
char *dp = reply;
|
char *dp = reply;
|
||||||
|
|||||||
@@ -150,6 +150,9 @@ protected:
|
|||||||
int getInterferenceThreshold() const override {
|
int getInterferenceThreshold() const override {
|
||||||
return _prefs.interference_threshold;
|
return _prefs.interference_threshold;
|
||||||
}
|
}
|
||||||
|
bool getCADEnabled() const override {
|
||||||
|
return _prefs.cad_enabled;
|
||||||
|
}
|
||||||
int getAGCResetInterval() const override {
|
int getAGCResetInterval() const override {
|
||||||
return ((int)_prefs.agc_reset_interval) * 4000; // milliseconds
|
return ((int)_prefs.agc_reset_interval) * 4000; // milliseconds
|
||||||
}
|
}
|
||||||
@@ -249,7 +252,6 @@ public:
|
|||||||
// To check if there is pending work
|
// To check if there is pending work
|
||||||
bool hasPendingWork() const;
|
bool hasPendingWork() const;
|
||||||
|
|
||||||
#if defined(USE_SX1262) || defined(USE_SX1268)
|
bool setRxBoostedGain(bool enable) override;
|
||||||
void setRxBoostedGain(bool enable) override;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -650,6 +650,7 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
|
|||||||
_prefs.flood_max_unscoped = 64;
|
_prefs.flood_max_unscoped = 64;
|
||||||
_prefs.flood_max_advert = 8;
|
_prefs.flood_max_advert = 8;
|
||||||
_prefs.interference_threshold = 0; // disabled
|
_prefs.interference_threshold = 0; // disabled
|
||||||
|
_prefs.cad_enabled = 0; // hardware CAD before TX (off by default; 'set cad on')
|
||||||
#ifdef ROOM_PASSWORD
|
#ifdef ROOM_PASSWORD
|
||||||
StrHelper::strncpy(_prefs.guest_password, ROOM_PASSWORD, sizeof(_prefs.guest_password));
|
StrHelper::strncpy(_prefs.guest_password, ROOM_PASSWORD, sizeof(_prefs.guest_password));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -144,6 +144,9 @@ protected:
|
|||||||
int getInterferenceThreshold() const override {
|
int getInterferenceThreshold() const override {
|
||||||
return _prefs.interference_threshold;
|
return _prefs.interference_threshold;
|
||||||
}
|
}
|
||||||
|
bool getCADEnabled() const override {
|
||||||
|
return _prefs.cad_enabled;
|
||||||
|
}
|
||||||
int getAGCResetInterval() const override {
|
int getAGCResetInterval() const override {
|
||||||
return ((int)_prefs.agc_reset_interval) * 4000; // milliseconds
|
return ((int)_prefs.agc_reset_interval) * 4000; // milliseconds
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -323,6 +323,9 @@ uint32_t SensorMesh::getDirectRetransmitDelay(const mesh::Packet* packet) {
|
|||||||
int SensorMesh::getInterferenceThreshold() const {
|
int SensorMesh::getInterferenceThreshold() const {
|
||||||
return _prefs.interference_threshold;
|
return _prefs.interference_threshold;
|
||||||
}
|
}
|
||||||
|
bool SensorMesh::getCADEnabled() const {
|
||||||
|
return _prefs.cad_enabled;
|
||||||
|
}
|
||||||
int SensorMesh::getAGCResetInterval() const {
|
int SensorMesh::getAGCResetInterval() const {
|
||||||
return ((int)_prefs.agc_reset_interval) * 4000; // milliseconds
|
return ((int)_prefs.agc_reset_interval) * 4000; // milliseconds
|
||||||
}
|
}
|
||||||
@@ -726,6 +729,7 @@ SensorMesh::SensorMesh(mesh::MainBoard& board, mesh::Radio& radio, mesh::Millise
|
|||||||
_prefs.disable_fwd = true;
|
_prefs.disable_fwd = true;
|
||||||
_prefs.flood_max = 64;
|
_prefs.flood_max = 64;
|
||||||
_prefs.interference_threshold = 0; // disabled
|
_prefs.interference_threshold = 0; // disabled
|
||||||
|
_prefs.cad_enabled = 0; // hardware CAD before TX (off by default; 'set cad on')
|
||||||
|
|
||||||
// GPS defaults
|
// GPS defaults
|
||||||
_prefs.gps_enabled = 0;
|
_prefs.gps_enabled = 0;
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ protected:
|
|||||||
uint32_t getRetransmitDelay(const mesh::Packet* packet) override;
|
uint32_t getRetransmitDelay(const mesh::Packet* packet) override;
|
||||||
uint32_t getDirectRetransmitDelay(const mesh::Packet* packet) override;
|
uint32_t getDirectRetransmitDelay(const mesh::Packet* packet) override;
|
||||||
int getInterferenceThreshold() const override;
|
int getInterferenceThreshold() const override;
|
||||||
|
bool getCADEnabled() const override;
|
||||||
int getAGCResetInterval() const override;
|
int getAGCResetInterval() const override;
|
||||||
void onAnonDataRecv(mesh::Packet* packet, const uint8_t* secret, const mesh::Identity& sender, uint8_t* data, size_t len) override;
|
void onAnonDataRecv(mesh::Packet* packet, const uint8_t* secret, const mesh::Identity& sender, uint8_t* data, size_t len) override;
|
||||||
int searchPeersByHash(const uint8_t* hash) override;
|
int searchPeersByHash(const uint8_t* hash) override;
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ uint32_t Dispatcher::getCADFailMaxDuration() const {
|
|||||||
void Dispatcher::loop() {
|
void Dispatcher::loop() {
|
||||||
if (millisHasNowPassed(next_floor_calib_time)) {
|
if (millisHasNowPassed(next_floor_calib_time)) {
|
||||||
_radio->triggerNoiseFloorCalibrate(getInterferenceThreshold());
|
_radio->triggerNoiseFloorCalibrate(getInterferenceThreshold());
|
||||||
|
_radio->setCADEnabled(getCADEnabled());
|
||||||
next_floor_calib_time = futureMillis(NOISE_FLOOR_CALIB_INTERVAL);
|
next_floor_calib_time = futureMillis(NOISE_FLOOR_CALIB_INTERVAL);
|
||||||
}
|
}
|
||||||
_radio->loop();
|
_radio->loop();
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ public:
|
|||||||
|
|
||||||
virtual void triggerNoiseFloorCalibrate(int threshold) { }
|
virtual void triggerNoiseFloorCalibrate(int threshold) { }
|
||||||
|
|
||||||
|
virtual void setCADEnabled(bool enable) { }
|
||||||
|
|
||||||
virtual void resetAGC() { }
|
virtual void resetAGC() { }
|
||||||
|
|
||||||
virtual bool isInRecvMode() const = 0;
|
virtual bool isInRecvMode() const = 0;
|
||||||
@@ -166,6 +168,7 @@ protected:
|
|||||||
virtual uint32_t getCADFailRetryDelay() const;
|
virtual uint32_t getCADFailRetryDelay() const;
|
||||||
virtual uint32_t getCADFailMaxDuration() const;
|
virtual uint32_t getCADFailMaxDuration() const;
|
||||||
virtual int getInterferenceThreshold() const { return 0; } // disabled by default
|
virtual int getInterferenceThreshold() const { return 0; } // disabled by default
|
||||||
|
virtual bool getCADEnabled() const { return false; } // hardware CAD disabled by default
|
||||||
virtual int getAGCResetInterval() const { return 0; } // disabled by default
|
virtual int getAGCResetInterval() const { return 0; } // disabled by default
|
||||||
virtual unsigned long getDutyCycleWindowMs() const { return 3600000; }
|
virtual unsigned long getDutyCycleWindowMs() const { return 3600000; }
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -100,7 +100,7 @@ protected:
|
|||||||
* \param auth_code a code to authenticate the packet
|
* \param auth_code a code to authenticate the packet
|
||||||
* \param flags zero for now
|
* \param flags zero for now
|
||||||
* \param path_snrs single byte SNR*4 for each hop in the path
|
* \param path_snrs single byte SNR*4 for each hop in the path
|
||||||
* \param path_hashes hashes if each repeater in the path
|
* \param path_hashes hashes of each repeater in the path
|
||||||
* \param path_len length of the path_snrs[] and path_hashes[] arrays
|
* \param path_len length of the path_snrs[] and path_hashes[] arrays
|
||||||
*/
|
*/
|
||||||
virtual void onTraceRecv(Packet* packet, uint32_t tag, uint32_t auth_code, uint8_t flags, const uint8_t* path_snrs, const uint8_t* path_hashes, uint8_t path_len) { }
|
virtual void onTraceRecv(Packet* packet, uint32_t tag, uint32_t auth_code, uint8_t flags, const uint8_t* path_snrs, const uint8_t* path_hashes, uint8_t path_len) { }
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ namespace mesh {
|
|||||||
#define PAYLOAD_TYPE_GRP_DATA 0x06 // an (unverified) group datagram (prefixed with channel hash, MAC) (enc data: data_type(uint16), data_len, blob)
|
#define PAYLOAD_TYPE_GRP_DATA 0x06 // an (unverified) group datagram (prefixed with channel hash, MAC) (enc data: data_type(uint16), data_len, blob)
|
||||||
#define PAYLOAD_TYPE_ANON_REQ 0x07 // generic request (prefixed with dest_hash, ephemeral pub_key, MAC) (enc data: ...)
|
#define PAYLOAD_TYPE_ANON_REQ 0x07 // generic request (prefixed with dest_hash, ephemeral pub_key, MAC) (enc data: ...)
|
||||||
#define PAYLOAD_TYPE_PATH 0x08 // returned path (prefixed with dest/src hashes, MAC) (enc data: path, extra)
|
#define PAYLOAD_TYPE_PATH 0x08 // returned path (prefixed with dest/src hashes, MAC) (enc data: path, extra)
|
||||||
#define PAYLOAD_TYPE_TRACE 0x09 // trace a path, collecting SNI for each hop
|
#define PAYLOAD_TYPE_TRACE 0x09 // trace a path, collecting SNR for each hop
|
||||||
#define PAYLOAD_TYPE_MULTIPART 0x0A // packet is one of a set of packets
|
#define PAYLOAD_TYPE_MULTIPART 0x0A // packet is one of a set of packets
|
||||||
#define PAYLOAD_TYPE_CONTROL 0x0B // a control/discovery packet
|
#define PAYLOAD_TYPE_CONTROL 0x0B // a control/discovery packet
|
||||||
//...
|
//...
|
||||||
|
|||||||
+18
-13
@@ -92,7 +92,8 @@ void CommonCLI::loadPrefsInt(FILESYSTEM* fs, const char* filename) {
|
|||||||
file.read((uint8_t *)&_prefs->flood_max_unscoped, sizeof(_prefs->flood_max_unscoped)); // 291
|
file.read((uint8_t *)&_prefs->flood_max_unscoped, sizeof(_prefs->flood_max_unscoped)); // 291
|
||||||
file.read((uint8_t *)&_prefs->flood_max_advert, sizeof(_prefs->flood_max_advert)); // 292
|
file.read((uint8_t *)&_prefs->flood_max_advert, sizeof(_prefs->flood_max_advert)); // 292
|
||||||
file.read((uint8_t *)&_prefs->radio_fem_rxgain, sizeof(_prefs->radio_fem_rxgain)); // 293
|
file.read((uint8_t *)&_prefs->radio_fem_rxgain, sizeof(_prefs->radio_fem_rxgain)); // 293
|
||||||
// next: 294
|
file.read((uint8_t *)&_prefs->cad_enabled, sizeof(_prefs->cad_enabled)); // 294
|
||||||
|
// next: 295
|
||||||
|
|
||||||
// sanitise bad pref values
|
// sanitise bad pref values
|
||||||
_prefs->rx_delay_base = constrain(_prefs->rx_delay_base, 0, 20.0f);
|
_prefs->rx_delay_base = constrain(_prefs->rx_delay_base, 0, 20.0f);
|
||||||
@@ -123,6 +124,7 @@ void CommonCLI::loadPrefsInt(FILESYSTEM* fs, const char* filename) {
|
|||||||
// sanitise settings
|
// sanitise settings
|
||||||
_prefs->rx_boosted_gain = constrain(_prefs->rx_boosted_gain, 0, 1); // boolean
|
_prefs->rx_boosted_gain = constrain(_prefs->rx_boosted_gain, 0, 1); // boolean
|
||||||
_prefs->radio_fem_rxgain = constrain(_prefs->radio_fem_rxgain, 0, 1); // boolean
|
_prefs->radio_fem_rxgain = constrain(_prefs->radio_fem_rxgain, 0, 1); // boolean
|
||||||
|
_prefs->cad_enabled = constrain(_prefs->cad_enabled, 0, 1); // boolean
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
@@ -187,7 +189,8 @@ void CommonCLI::savePrefs(FILESYSTEM* fs) {
|
|||||||
file.write((uint8_t *)&_prefs->flood_max_unscoped, sizeof(_prefs->flood_max_unscoped)); // 291
|
file.write((uint8_t *)&_prefs->flood_max_unscoped, sizeof(_prefs->flood_max_unscoped)); // 291
|
||||||
file.write((uint8_t *)&_prefs->flood_max_advert, sizeof(_prefs->flood_max_advert)); // 292
|
file.write((uint8_t *)&_prefs->flood_max_advert, sizeof(_prefs->flood_max_advert)); // 292
|
||||||
file.write((uint8_t *)&_prefs->radio_fem_rxgain, sizeof(_prefs->radio_fem_rxgain)); // 293
|
file.write((uint8_t *)&_prefs->radio_fem_rxgain, sizeof(_prefs->radio_fem_rxgain)); // 293
|
||||||
// next: 294
|
file.write((uint8_t *)&_prefs->cad_enabled, sizeof(_prefs->cad_enabled)); // 294
|
||||||
|
// next: 295
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
@@ -503,6 +506,10 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep
|
|||||||
_prefs->interference_threshold = atoi(&config[11]);
|
_prefs->interference_threshold = atoi(&config[11]);
|
||||||
savePrefs();
|
savePrefs();
|
||||||
strcpy(reply, "OK");
|
strcpy(reply, "OK");
|
||||||
|
} else if (memcmp(config, "cad ", 4) == 0) {
|
||||||
|
_prefs->cad_enabled = memcmp(&config[4], "on", 2) == 0;
|
||||||
|
savePrefs();
|
||||||
|
strcpy(reply, "OK");
|
||||||
} else if (memcmp(config, "agc.reset.interval ", 19) == 0) {
|
} else if (memcmp(config, "agc.reset.interval ", 19) == 0) {
|
||||||
_prefs->agc_reset_interval = atoi(&config[19]) / 4;
|
_prefs->agc_reset_interval = atoi(&config[19]) / 4;
|
||||||
savePrefs();
|
savePrefs();
|
||||||
@@ -564,13 +571,15 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep
|
|||||||
_prefs->disable_fwd = memcmp(&config[7], "off", 3) == 0;
|
_prefs->disable_fwd = memcmp(&config[7], "off", 3) == 0;
|
||||||
savePrefs();
|
savePrefs();
|
||||||
strcpy(reply, _prefs->disable_fwd ? "OK - repeat is now OFF" : "OK - repeat is now ON");
|
strcpy(reply, _prefs->disable_fwd ? "OK - repeat is now OFF" : "OK - repeat is now ON");
|
||||||
#if defined(USE_SX1262) || defined(USE_SX1268) || defined(USE_LR1110)
|
|
||||||
} else if (memcmp(config, "radio.rxgain ", 13) == 0) {
|
} else if (memcmp(config, "radio.rxgain ", 13) == 0) {
|
||||||
_prefs->rx_boosted_gain = memcmp(&config[13], "on", 2) == 0;
|
bool enabled = memcmp(&config[13], "on", 2) == 0;
|
||||||
strcpy(reply, "OK");
|
_prefs->rx_boosted_gain = enabled;
|
||||||
savePrefs();
|
savePrefs();
|
||||||
_callbacks->setRxBoostedGain(_prefs->rx_boosted_gain);
|
if (_callbacks->setRxBoostedGain(enabled)) {
|
||||||
#endif
|
strcpy(reply, "OK");
|
||||||
|
} else {
|
||||||
|
strcpy(reply, "Error: unsupported");
|
||||||
|
}
|
||||||
} else if (memcmp(config, "radio.fem.rxgain ", 17) == 0) {
|
} else if (memcmp(config, "radio.fem.rxgain ", 17) == 0) {
|
||||||
if (!_board->canControlLoRaFemLna()) {
|
if (!_board->canControlLoRaFemLna()) {
|
||||||
strcpy(reply, "Error: unsupported");
|
strcpy(reply, "Error: unsupported");
|
||||||
@@ -801,6 +810,8 @@ void CommonCLI::handleGetCmd(uint32_t sender_timestamp, char* command, char* rep
|
|||||||
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->airtime_factor));
|
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->airtime_factor));
|
||||||
} else if (memcmp(config, "int.thresh", 10) == 0) {
|
} else if (memcmp(config, "int.thresh", 10) == 0) {
|
||||||
sprintf(reply, "> %d", (uint32_t) _prefs->interference_threshold);
|
sprintf(reply, "> %d", (uint32_t) _prefs->interference_threshold);
|
||||||
|
} else if (memcmp(config, "cad", 3) == 0) {
|
||||||
|
sprintf(reply, "> %s", _prefs->cad_enabled ? "on" : "off");
|
||||||
} else if (memcmp(config, "agc.reset.interval", 18) == 0) {
|
} else if (memcmp(config, "agc.reset.interval", 18) == 0) {
|
||||||
sprintf(reply, "> %d", ((uint32_t) _prefs->agc_reset_interval) * 4);
|
sprintf(reply, "> %d", ((uint32_t) _prefs->agc_reset_interval) * 4);
|
||||||
} else if (memcmp(config, "multi.acks", 10) == 0) {
|
} else if (memcmp(config, "multi.acks", 10) == 0) {
|
||||||
@@ -826,10 +837,8 @@ void CommonCLI::handleGetCmd(uint32_t sender_timestamp, char* command, char* rep
|
|||||||
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->node_lat));
|
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->node_lat));
|
||||||
} else if (memcmp(config, "lon", 3) == 0) {
|
} else if (memcmp(config, "lon", 3) == 0) {
|
||||||
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->node_lon));
|
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->node_lon));
|
||||||
#if defined(USE_SX1262) || defined(USE_SX1268) || defined(USE_LR1110)
|
|
||||||
} else if (memcmp(config, "radio.rxgain", 12) == 0) {
|
} else if (memcmp(config, "radio.rxgain", 12) == 0) {
|
||||||
sprintf(reply, "> %s", _prefs->rx_boosted_gain ? "on" : "off");
|
sprintf(reply, "> %s", _prefs->rx_boosted_gain ? "on" : "off");
|
||||||
#endif
|
|
||||||
} else if (memcmp(config, "radio.fem.rxgain", 16) == 0) {
|
} else if (memcmp(config, "radio.fem.rxgain", 16) == 0) {
|
||||||
if (!_board->canControlLoRaFemLna()) {
|
if (!_board->canControlLoRaFemLna()) {
|
||||||
strcpy(reply, "Error: unsupported");
|
strcpy(reply, "Error: unsupported");
|
||||||
@@ -944,13 +953,9 @@ void CommonCLI::handleGetCmd(uint32_t sender_timestamp, char* command, char* rep
|
|||||||
strcpy(reply, "ERROR: Power management not supported");
|
strcpy(reply, "ERROR: Power management not supported");
|
||||||
#endif
|
#endif
|
||||||
} else if (memcmp(config, "pwrmgt.bootreason", 17) == 0) {
|
} else if (memcmp(config, "pwrmgt.bootreason", 17) == 0) {
|
||||||
#ifdef NRF52_POWER_MANAGEMENT
|
|
||||||
sprintf(reply, "> Reset: %s; Shutdown: %s",
|
sprintf(reply, "> Reset: %s; Shutdown: %s",
|
||||||
_board->getResetReasonString(_board->getResetReason()),
|
_board->getResetReasonString(_board->getResetReason()),
|
||||||
_board->getShutdownReasonString(_board->getShutdownReason()));
|
_board->getShutdownReasonString(_board->getShutdownReason()));
|
||||||
#else
|
|
||||||
strcpy(reply, "ERROR: Power management not supported");
|
|
||||||
#endif
|
|
||||||
} else if (memcmp(config, "pwrmgt.bootmv", 13) == 0) {
|
} else if (memcmp(config, "pwrmgt.bootmv", 13) == 0) {
|
||||||
#ifdef NRF52_POWER_MANAGEMENT
|
#ifdef NRF52_POWER_MANAGEMENT
|
||||||
sprintf(reply, "> %u mV", _board->getBootVoltage());
|
sprintf(reply, "> %u mV", _board->getBootVoltage());
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ struct NodePrefs { // persisted to file
|
|||||||
uint8_t radio_fem_rxgain; // LoRa FEM RX gain setting
|
uint8_t radio_fem_rxgain; // LoRa FEM RX gain setting
|
||||||
uint8_t path_hash_mode; // which path mode to use when sending
|
uint8_t path_hash_mode; // which path mode to use when sending
|
||||||
uint8_t loop_detect;
|
uint8_t loop_detect;
|
||||||
|
uint8_t cad_enabled; // hardware Channel Activity Detection before TX (boolean)
|
||||||
};
|
};
|
||||||
|
|
||||||
class CommonCLICallbacks {
|
class CommonCLICallbacks {
|
||||||
@@ -110,8 +111,8 @@ public:
|
|||||||
// no op by default
|
// no op by default
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void setRxBoostedGain(bool enable) {
|
virtual bool setRxBoostedGain(bool enable) {
|
||||||
// no op by default
|
return false; // CommonCLI reports unsupported if not overridden by wrapper
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -155,6 +155,42 @@ public:
|
|||||||
void setInhibitSleep(bool inhibit) {
|
void setInhibitSleep(bool inhibit) {
|
||||||
inhibit_sleep = inhibit;
|
inhibit_sleep = inhibit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t getResetReason() const override {
|
||||||
|
return esp_reset_reason();
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://docs.espressif.com/projects/esp-idf/en/v4.4.7/esp32/api-reference/system/system.html
|
||||||
|
const char* getResetReasonString(uint32_t reason) {
|
||||||
|
switch (reason) {
|
||||||
|
case ESP_RST_UNKNOWN:
|
||||||
|
return "Unknown or first boot";
|
||||||
|
case ESP_RST_POWERON:
|
||||||
|
return "Power-on reset";
|
||||||
|
case ESP_RST_EXT:
|
||||||
|
return "External reset";
|
||||||
|
case ESP_RST_SW:
|
||||||
|
return "Software reset";
|
||||||
|
case ESP_RST_PANIC:
|
||||||
|
return "Panic / exception reset";
|
||||||
|
case ESP_RST_INT_WDT:
|
||||||
|
return "Interrupt watchdog reset";
|
||||||
|
case ESP_RST_TASK_WDT:
|
||||||
|
return "Task watchdog reset";
|
||||||
|
case ESP_RST_WDT:
|
||||||
|
return "Other watchdog reset";
|
||||||
|
case ESP_RST_DEEPSLEEP:
|
||||||
|
return "Wake from deep sleep";
|
||||||
|
case ESP_RST_BROWNOUT:
|
||||||
|
return "Brownout (low voltage)";
|
||||||
|
case ESP_RST_SDIO:
|
||||||
|
return "SDIO reset";
|
||||||
|
default:
|
||||||
|
static char buf[40];
|
||||||
|
snprintf(buf, sizeof(buf), "Unknown reset reason (%d)", reason);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ESP32RTCClock : public mesh::RTCClock {
|
class ESP32RTCClock : public mesh::RTCClock {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ void ESPNowBridge::begin() {
|
|||||||
// Initialize WiFi in station mode
|
// Initialize WiFi in station mode
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
|
|
||||||
// Set wifi channel
|
// Set Wi-Fi channel
|
||||||
if (esp_wifi_set_channel(_prefs->bridge_channel, WIFI_SECOND_CHAN_NONE) != ESP_OK) {
|
if (esp_wifi_set_channel(_prefs->bridge_channel, WIFI_SECOND_CHAN_NONE) != ESP_OK) {
|
||||||
BRIDGE_DEBUG_PRINTLN("Error setting WIFI channel to %d\n", _prefs->bridge_channel);
|
BRIDGE_DEBUG_PRINTLN("Error setting WIFI channel to %d\n", _prefs->bridge_channel);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
* These two functions do nothing for ESP-NOW, but are needed for the
|
* These two functions do nothing for ESP-NOW, but are needed for the
|
||||||
* Radio interface.
|
* Radio interface.
|
||||||
*/
|
*/
|
||||||
virtual void setRxBoostedGainMode(bool) { }
|
virtual bool setRxBoostedGainMode(bool) { }
|
||||||
virtual bool getRxBoostedGainMode() const { return false; }
|
virtual bool getRxBoostedGainMode() const { return false; }
|
||||||
|
|
||||||
uint32_t intID();
|
uint32_t intID();
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public:
|
|||||||
|
|
||||||
void doResetAGC() override { sx126xResetAGC((SX126x *)_radio); }
|
void doResetAGC() override { sx126xResetAGC((SX126x *)_radio); }
|
||||||
|
|
||||||
void setRxBoostedGainMode(bool en) override {
|
bool setRxBoostedGainMode(bool en) override {
|
||||||
((CustomLLCC68 *)_radio)->setRxBoostedGainMode(en);
|
return ((CustomLLCC68 *)_radio)->setRxBoostedGainMode(en) == RADIOLIB_ERR_NONE;
|
||||||
}
|
}
|
||||||
bool getRxBoostedGainMode() const override {
|
bool getRxBoostedGainMode() const override {
|
||||||
return ((CustomLLCC68 *)_radio)->getRxBoostedGainMode();
|
return ((CustomLLCC68 *)_radio)->getRxBoostedGainMode();
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ public:
|
|||||||
|
|
||||||
uint8_t getSpreadingFactor() const override { return ((CustomLR1110 *)_radio)->getSpreadingFactor(); }
|
uint8_t getSpreadingFactor() const override { return ((CustomLR1110 *)_radio)->getSpreadingFactor(); }
|
||||||
|
|
||||||
void setRxBoostedGainMode(bool en) override {
|
bool setRxBoostedGainMode(bool en) override {
|
||||||
((CustomLR1110 *)_radio)->setRxBoostedGainMode(en);
|
return ((CustomLR1110 *)_radio)->setRxBoostedGainMode(en) == RADIOLIB_ERR_NONE;
|
||||||
}
|
}
|
||||||
bool getRxBoostedGainMode() const override {
|
bool getRxBoostedGainMode() const override {
|
||||||
return ((CustomLR1110 *)_radio)->getRxBoostedGainMode();
|
return ((CustomLR1110 *)_radio)->getRxBoostedGainMode();
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ public:
|
|||||||
|
|
||||||
void doResetAGC() override { sx126xResetAGC((SX126x *)_radio); }
|
void doResetAGC() override { sx126xResetAGC((SX126x *)_radio); }
|
||||||
|
|
||||||
void setRxBoostedGainMode(bool en) override {
|
bool setRxBoostedGainMode(bool en) override {
|
||||||
((CustomSX1262 *)_radio)->setRxBoostedGainMode(en);
|
return ((CustomSX1262 *)_radio)->setRxBoostedGainMode(en) == RADIOLIB_ERR_NONE;
|
||||||
}
|
}
|
||||||
bool getRxBoostedGainMode() const override {
|
bool getRxBoostedGainMode() const override {
|
||||||
return ((CustomSX1262 *)_radio)->getRxBoostedGainMode();
|
return ((CustomSX1262 *)_radio)->getRxBoostedGainMode();
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ public:
|
|||||||
|
|
||||||
void doResetAGC() override { sx126xResetAGC((SX126x *)_radio); }
|
void doResetAGC() override { sx126xResetAGC((SX126x *)_radio); }
|
||||||
|
|
||||||
void setRxBoostedGainMode(bool en) override {
|
bool setRxBoostedGainMode(bool en) override {
|
||||||
((CustomSX1268 *)_radio)->setRxBoostedGainMode(en);
|
return ((CustomSX1268 *)_radio)->setRxBoostedGainMode(en) == RADIOLIB_ERR_NONE;
|
||||||
}
|
}
|
||||||
bool getRxBoostedGainMode() const override {
|
bool getRxBoostedGainMode() const override {
|
||||||
return ((CustomSX1268 *)_radio)->getRxBoostedGainMode();
|
return ((CustomSX1268 *)_radio)->getRxBoostedGainMode();
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ void RadioLibWrapper::begin() {
|
|||||||
|
|
||||||
_noise_floor = 0;
|
_noise_floor = 0;
|
||||||
_threshold = 0;
|
_threshold = 0;
|
||||||
|
_cad_enabled = false;
|
||||||
|
|
||||||
// start average out some samples
|
// start average out some samples
|
||||||
_num_floor_samples = 0;
|
_num_floor_samples = 0;
|
||||||
@@ -178,10 +179,26 @@ void RadioLibWrapper::onSendFinished() {
|
|||||||
state = STATE_IDLE;
|
state = STATE_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16_t RadioLibWrapper::performChannelScan() {
|
||||||
|
return _radio->scanChannel();
|
||||||
|
}
|
||||||
|
|
||||||
bool RadioLibWrapper::isChannelActive() {
|
bool RadioLibWrapper::isChannelActive() {
|
||||||
return _threshold == 0
|
// int.thresh: RSSI-based interference detection (relative to noise floor)
|
||||||
? false // interference check is disabled
|
if (_threshold != 0 && getCurrentRSSI() > _noise_floor + _threshold) return true;
|
||||||
: getCurrentRSSI() > _noise_floor + _threshold;
|
|
||||||
|
// cad: hardware channel activity detection
|
||||||
|
if (_cad_enabled) {
|
||||||
|
int16_t result = performChannelScan();
|
||||||
|
// scanChannel() triggers DIO interrupt (CAD done) which sets STATE_INT_READY
|
||||||
|
// via setFlag() ISR. Clear it before restarting RX so recvRaw() doesn't
|
||||||
|
// try to read a non-existent packet and count a spurious recv error.
|
||||||
|
state = STATE_IDLE;
|
||||||
|
startRecv();
|
||||||
|
if (result != RADIOLIB_CHANNEL_FREE) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
float RadioLibWrapper::getLastRSSI() const {
|
float RadioLibWrapper::getLastRSSI() const {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ protected:
|
|||||||
mesh::MainBoard* _board;
|
mesh::MainBoard* _board;
|
||||||
uint32_t n_recv, n_sent, n_recv_errors;
|
uint32_t n_recv, n_sent, n_recv_errors;
|
||||||
int16_t _noise_floor, _threshold;
|
int16_t _noise_floor, _threshold;
|
||||||
|
bool _cad_enabled;
|
||||||
uint16_t _num_floor_samples;
|
uint16_t _num_floor_samples;
|
||||||
int32_t _floor_sample_sum;
|
int32_t _floor_sample_sum;
|
||||||
uint8_t _preamble_sf;
|
uint8_t _preamble_sf;
|
||||||
@@ -32,7 +33,7 @@ public:
|
|||||||
bool isInRecvMode() const override;
|
bool isInRecvMode() const override;
|
||||||
bool isChannelActive();
|
bool isChannelActive();
|
||||||
|
|
||||||
bool isReceiving() override {
|
bool isReceiving() override {
|
||||||
if (isReceivingPacket()) return true;
|
if (isReceivingPacket()) return true;
|
||||||
|
|
||||||
return isChannelActive();
|
return isChannelActive();
|
||||||
@@ -46,9 +47,11 @@ public:
|
|||||||
virtual uint8_t getSpreadingFactor() const { return LORA_SF; }
|
virtual uint8_t getSpreadingFactor() const { return LORA_SF; }
|
||||||
static uint16_t preambleLengthForSF(uint8_t sf) { return sf <= 8 ? 32 : 16; }
|
static uint16_t preambleLengthForSF(uint8_t sf) { return sf <= 8 ? 32 : 16; }
|
||||||
void updatePreamble(uint8_t sf) { _preamble_sf = sf; _radio->setPreambleLength(preambleLengthForSF(sf)); }
|
void updatePreamble(uint8_t sf) { _preamble_sf = sf; _radio->setPreambleLength(preambleLengthForSF(sf)); }
|
||||||
|
virtual int16_t performChannelScan();
|
||||||
|
|
||||||
int getNoiseFloor() const override { return _noise_floor; }
|
int getNoiseFloor() const override { return _noise_floor; }
|
||||||
void triggerNoiseFloorCalibrate(int threshold) override;
|
void triggerNoiseFloorCalibrate(int threshold) override;
|
||||||
|
void setCADEnabled(bool enable) override { _cad_enabled = enable; }
|
||||||
void resetAGC() override;
|
void resetAGC() override;
|
||||||
|
|
||||||
void loop() override;
|
void loop() override;
|
||||||
@@ -63,7 +66,7 @@ public:
|
|||||||
|
|
||||||
float packetScore(float snr, int packet_len) override { return packetScoreInt(snr, 10, packet_len); } // assume sf=10
|
float packetScore(float snr, int packet_len) override { return packetScoreInt(snr, 10, packet_len); } // assume sf=10
|
||||||
|
|
||||||
virtual void setRxBoostedGainMode(bool) { }
|
virtual bool setRxBoostedGainMode(bool) { return false; }
|
||||||
virtual bool getRxBoostedGainMode() const { return false; }
|
virtual bool getRxBoostedGainMode() const { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ public:
|
|||||||
case LPP_GPS:
|
case LPP_GPS:
|
||||||
_pos += 9; break;
|
_pos += 9; break;
|
||||||
case LPP_POLYLINE:
|
case LPP_POLYLINE:
|
||||||
_pos += 8; break; // TODO: this is MINIMIUM
|
_pos += 8; break; // TODO: this is MINIMUM
|
||||||
case LPP_GYROMETER:
|
case LPP_GYROMETER:
|
||||||
case LPP_ACCELEROMETER:
|
case LPP_ACCELEROMETER:
|
||||||
_pos += 6; break;
|
_pos += 6; break;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ static int _internal_flash_read(const struct lfs_config *c, lfs_block_t block, l
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Program a region in a block. The block must have previously
|
// Program a region in a block. The block must have previously
|
||||||
// been erased. Negative error codes are propogated to the user.
|
// been erased. Negative error codes are propagated to the user.
|
||||||
// May return LFS_ERR_CORRUPT if the block should be considered bad.
|
// May return LFS_ERR_CORRUPT if the block should be considered bad.
|
||||||
static int _internal_flash_prog(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, const void *buffer, lfs_size_t size)
|
static int _internal_flash_prog(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, const void *buffer, lfs_size_t size)
|
||||||
{
|
{
|
||||||
@@ -62,7 +62,7 @@ static int _internal_flash_prog(const struct lfs_config *c, lfs_block_t block, l
|
|||||||
|
|
||||||
// Erase a block. A block must be erased before being programmed.
|
// Erase a block. A block must be erased before being programmed.
|
||||||
// The state of an erased block is undefined. Negative error codes
|
// The state of an erased block is undefined. Negative error codes
|
||||||
// are propogated to the user.
|
// are propagated to the user.
|
||||||
// May return LFS_ERR_CORRUPT if the block should be considered bad.
|
// May return LFS_ERR_CORRUPT if the block should be considered bad.
|
||||||
static int _internal_flash_erase(const struct lfs_config *c, lfs_block_t block)
|
static int _internal_flash_erase(const struct lfs_config *c, lfs_block_t block)
|
||||||
{
|
{
|
||||||
@@ -87,7 +87,7 @@ static int _internal_flash_erase(const struct lfs_config *c, lfs_block_t block)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sync the state of the underlying block device. Negative error codes
|
// Sync the state of the underlying block device. Negative error codes
|
||||||
// are propogated to the user.
|
// are propagated to the user.
|
||||||
static int _internal_flash_sync(const struct lfs_config *c)
|
static int _internal_flash_sync(const struct lfs_config *c)
|
||||||
{
|
{
|
||||||
return LFS_ERR_OK; // don't need sync
|
return LFS_ERR_OK; // don't need sync
|
||||||
|
|||||||
@@ -1166,7 +1166,7 @@ char DefaultFontTableLookup(const uint8_t ch) {
|
|||||||
uint8_t last = LASTCHAR; // get last char
|
uint8_t last = LASTCHAR; // get last char
|
||||||
LASTCHAR = ch;
|
LASTCHAR = ch;
|
||||||
|
|
||||||
switch (last) { // conversion depnding on first UTF8-character
|
switch (last) { // conversion depending on first UTF8-character
|
||||||
case 0xC2: return (uint8_t) ch;
|
case 0xC2: return (uint8_t) ch;
|
||||||
case 0xC3: return (uint8_t) (ch | 0xC0);
|
case 0xC3: return (uint8_t) (ch | 0xC0);
|
||||||
case 0x82: if (ch == 0xAC) return (uint8_t) 0x80; // special case Euro-symbol
|
case 0x82: if (ch == 0xAC) return (uint8_t) 0x80; // special case Euro-symbol
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
[Heltec_mesh_solar]
|
[Heltec_mesh_solar]
|
||||||
extends = nrf52_base
|
extends = nrf52_base
|
||||||
board = heltec_mesh_solar
|
board = heltec_mesh_solar
|
||||||
platform_packages = framework-arduinoadafruitnrf52
|
|
||||||
board_build.ldscript = boards/nrf52840_s140_v6.ld
|
board_build.ldscript = boards/nrf52840_s140_v6.ld
|
||||||
build_flags = ${nrf52_base.build_flags}
|
build_flags = ${nrf52_base.build_flags}
|
||||||
-I src/helpers/nrf52
|
-I src/helpers/nrf52
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
#include "HeltecTowerV2Board.h"
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <Wire.h>
|
||||||
|
|
||||||
|
extern void variant_shutdown();
|
||||||
|
|
||||||
|
#ifdef NRF52_POWER_MANAGEMENT
|
||||||
|
const PowerMgtConfig power_config = {
|
||||||
|
.lpcomp_ain_channel = PWRMGT_LPCOMP_AIN,
|
||||||
|
.lpcomp_refsel = PWRMGT_LPCOMP_REFSEL,
|
||||||
|
.voltage_bootlock = PWRMGT_VOLTAGE_BOOTLOCK
|
||||||
|
};
|
||||||
|
|
||||||
|
void HeltecTowerV2Board::initiateShutdown(uint8_t reason) {
|
||||||
|
pinMode(PIN_GPS_EN, OUTPUT);
|
||||||
|
digitalWrite(PIN_GPS_EN, !PIN_GPS_EN_ACTIVE);
|
||||||
|
pinMode(PIN_GPS_STANDBY, OUTPUT);
|
||||||
|
digitalWrite(PIN_GPS_STANDBY, LOW);
|
||||||
|
pinMode(PIN_GPS_RESET, OUTPUT);
|
||||||
|
digitalWrite(PIN_GPS_RESET, GPS_RESET_MODE);
|
||||||
|
loRaFEMControl.setSleepModeEnable();
|
||||||
|
|
||||||
|
bool enable_lpcomp = (reason == SHUTDOWN_REASON_LOW_VOLTAGE ||
|
||||||
|
reason == SHUTDOWN_REASON_BOOT_PROTECT);
|
||||||
|
pinMode(PIN_BAT_CTL, OUTPUT);
|
||||||
|
digitalWrite(PIN_BAT_CTL, enable_lpcomp ? HIGH : LOW);
|
||||||
|
|
||||||
|
if (enable_lpcomp) {
|
||||||
|
configureVoltageWake(power_config.lpcomp_ain_channel, power_config.lpcomp_refsel);
|
||||||
|
}
|
||||||
|
|
||||||
|
variant_shutdown();
|
||||||
|
enterSystemOff(reason);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void HeltecTowerV2Board::begin() {
|
||||||
|
NRF52Board::begin();
|
||||||
|
|
||||||
|
pinMode(P_LORA_TX_LED, OUTPUT);
|
||||||
|
digitalWrite(P_LORA_TX_LED, !LED_STATE_ON);
|
||||||
|
|
||||||
|
pinMode(PIN_BAT_CTL, OUTPUT);
|
||||||
|
digitalWrite(PIN_BAT_CTL, LOW);
|
||||||
|
|
||||||
|
#ifdef NRF52_POWER_MANAGEMENT
|
||||||
|
checkBootVoltage(&power_config);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL);
|
||||||
|
Wire.begin();
|
||||||
|
|
||||||
|
pinMode(PIN_GPS_EN, OUTPUT);
|
||||||
|
digitalWrite(PIN_GPS_EN, !PIN_GPS_EN_ACTIVE);
|
||||||
|
pinMode(PIN_GPS_RESET, OUTPUT);
|
||||||
|
digitalWrite(PIN_GPS_RESET, GPS_RESET_MODE);
|
||||||
|
pinMode(PIN_GPS_STANDBY, OUTPUT);
|
||||||
|
digitalWrite(PIN_GPS_STANDBY, HIGH);
|
||||||
|
loRaFEMControl.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HeltecTowerV2Board::onBeforeTransmit() {
|
||||||
|
digitalWrite(P_LORA_TX_LED, LED_STATE_ON);
|
||||||
|
loRaFEMControl.setTxModeEnable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HeltecTowerV2Board::onAfterTransmit() {
|
||||||
|
digitalWrite(P_LORA_TX_LED, !LED_STATE_ON);
|
||||||
|
loRaFEMControl.setRxModeEnable();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t HeltecTowerV2Board::getBattMilliVolts() {
|
||||||
|
analogReadResolution(12);
|
||||||
|
analogReference(VBAT_AR_INTERNAL);
|
||||||
|
pinMode(PIN_VBAT_READ, INPUT);
|
||||||
|
pinMode(PIN_BAT_CTL, OUTPUT);
|
||||||
|
digitalWrite(PIN_BAT_CTL, HIGH);
|
||||||
|
|
||||||
|
delay(10);
|
||||||
|
int adcvalue = analogRead(PIN_VBAT_READ);
|
||||||
|
digitalWrite(PIN_BAT_CTL, LOW);
|
||||||
|
|
||||||
|
return (uint16_t)((float)adcvalue * MV_LSB * ADC_MULTIPLIER);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* HeltecTowerV2Board::getManufacturerName() const {
|
||||||
|
return "Heltec Tower V2";
|
||||||
|
}
|
||||||
|
|
||||||
|
void HeltecTowerV2Board::powerOff() {
|
||||||
|
pinMode(PIN_GPS_EN, OUTPUT);
|
||||||
|
digitalWrite(PIN_GPS_EN, !PIN_GPS_EN_ACTIVE);
|
||||||
|
pinMode(PIN_GPS_STANDBY, OUTPUT);
|
||||||
|
digitalWrite(PIN_GPS_STANDBY, LOW);
|
||||||
|
pinMode(PIN_GPS_RESET, OUTPUT);
|
||||||
|
digitalWrite(PIN_GPS_RESET, GPS_RESET_MODE);
|
||||||
|
loRaFEMControl.setSleepModeEnable();
|
||||||
|
pinMode(PIN_BAT_CTL, OUTPUT);
|
||||||
|
digitalWrite(PIN_BAT_CTL, LOW);
|
||||||
|
variant_shutdown();
|
||||||
|
sd_power_system_off();
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <MeshCore.h>
|
||||||
|
#include <helpers/NRF52Board.h>
|
||||||
|
#include "LoRaFEMControl.h"
|
||||||
|
|
||||||
|
class HeltecTowerV2Board : public NRF52BoardDCDC {
|
||||||
|
protected:
|
||||||
|
#ifdef NRF52_POWER_MANAGEMENT
|
||||||
|
void initiateShutdown(uint8_t reason) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public:
|
||||||
|
LoRaFEMControl loRaFEMControl;
|
||||||
|
|
||||||
|
HeltecTowerV2Board() : NRF52Board("TOWER_V2_OTA") {}
|
||||||
|
void begin();
|
||||||
|
void onBeforeTransmit() override;
|
||||||
|
void onAfterTransmit() override;
|
||||||
|
uint16_t getBattMilliVolts() override;
|
||||||
|
const char* getManufacturerName() const override;
|
||||||
|
void powerOff() override;
|
||||||
|
};
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
#include "LoRaFEMControl.h"
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include "variant.h"
|
||||||
|
|
||||||
|
static void enableFEMPower() {
|
||||||
|
bool wasOff = digitalRead(LORA_KCT8103L_EN) != HIGH;
|
||||||
|
digitalWrite(LORA_KCT8103L_EN, HIGH);
|
||||||
|
if (wasOff) {
|
||||||
|
delay(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoRaFEMControl::init() {
|
||||||
|
pinMode(LORA_KCT8103L_EN, OUTPUT);
|
||||||
|
digitalWrite(LORA_KCT8103L_EN, HIGH);
|
||||||
|
delay(1);
|
||||||
|
pinMode(LORA_KCT8103L_TX_RX, OUTPUT);
|
||||||
|
digitalWrite(LORA_KCT8103L_TX_RX, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoRaFEMControl::setSleepModeEnable() {
|
||||||
|
pinMode(LORA_KCT8103L_EN, OUTPUT);
|
||||||
|
digitalWrite(LORA_KCT8103L_EN, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoRaFEMControl::setTxModeEnable() {
|
||||||
|
enableFEMPower();
|
||||||
|
digitalWrite(LORA_KCT8103L_TX_RX, HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoRaFEMControl::setRxModeEnable() {
|
||||||
|
enableFEMPower();
|
||||||
|
digitalWrite(LORA_KCT8103L_TX_RX, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoRaFEMControl::setRxModeEnableWhenMCUSleep() {
|
||||||
|
enableFEMPower();
|
||||||
|
digitalWrite(LORA_KCT8103L_TX_RX, LOW);
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class LoRaFEMControl {
|
||||||
|
public:
|
||||||
|
LoRaFEMControl() {}
|
||||||
|
virtual ~LoRaFEMControl() {}
|
||||||
|
|
||||||
|
void init();
|
||||||
|
void setSleepModeEnable();
|
||||||
|
void setTxModeEnable();
|
||||||
|
void setRxModeEnable();
|
||||||
|
void setRxModeEnableWhenMCUSleep();
|
||||||
|
};
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
[Heltec_tower_v2]
|
||||||
|
extends = nrf52_base
|
||||||
|
board = heltec_tower_v2
|
||||||
|
board_build.ldscript = boards/nrf52840_s140_v6.ld
|
||||||
|
build_flags = ${nrf52_base.build_flags}
|
||||||
|
-D ENV_INCLUDE_GPS=1
|
||||||
|
-I lib/nrf52/s140_nrf52_6.1.1_API/include
|
||||||
|
-I lib/nrf52/s140_nrf52_6.1.1_API/include/nrf52
|
||||||
|
-I variants/heltec_tower_v2
|
||||||
|
-D HELTEC_TOWER_V2
|
||||||
|
-D NRF52_POWER_MANAGEMENT
|
||||||
|
-D RADIO_CLASS=CustomSX1262
|
||||||
|
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||||
|
-D LORA_TX_POWER=12
|
||||||
|
-D MAX_LORA_TX_POWER=22 ; Max SX1262 output -> ~29dBm at antenna
|
||||||
|
-D SX126X_CURRENT_LIMIT=140
|
||||||
|
-D SX126X_RX_BOOSTED_GAIN=1
|
||||||
|
build_src_filter = ${nrf52_base.build_src_filter}
|
||||||
|
+<helpers/*.cpp>
|
||||||
|
+<helpers/sensors>
|
||||||
|
+<../variants/heltec_tower_v2>
|
||||||
|
lib_deps =
|
||||||
|
${nrf52_base.lib_deps}
|
||||||
|
stevemarple/MicroNMEA @ ^2.0.6
|
||||||
|
debug_tool = jlink
|
||||||
|
upload_protocol = nrfutil
|
||||||
|
|
||||||
|
[env:Heltec_tower_v2_repeater]
|
||||||
|
extends = Heltec_tower_v2
|
||||||
|
build_src_filter = ${Heltec_tower_v2.build_src_filter}
|
||||||
|
+<../examples/simple_repeater>
|
||||||
|
build_flags =
|
||||||
|
${Heltec_tower_v2.build_flags}
|
||||||
|
-D ADVERT_NAME='"Heltec_Tower_V2 Repeater"'
|
||||||
|
-D ADVERT_LAT=0.0
|
||||||
|
-D ADVERT_LON=0.0
|
||||||
|
-D ADMIN_PASSWORD='"password"'
|
||||||
|
-D MAX_NEIGHBOURS=50
|
||||||
|
; -D MESH_PACKET_LOGGING=1
|
||||||
|
; -D MESH_DEBUG=1
|
||||||
|
|
||||||
|
[env:Heltec_tower_v2_room_server]
|
||||||
|
extends = Heltec_tower_v2
|
||||||
|
build_src_filter = ${Heltec_tower_v2.build_src_filter}
|
||||||
|
+<../examples/simple_room_server>
|
||||||
|
build_flags =
|
||||||
|
${Heltec_tower_v2.build_flags}
|
||||||
|
-D ADVERT_NAME='"Heltec_Tower_V2 Room"'
|
||||||
|
-D ADVERT_LAT=0.0
|
||||||
|
-D ADVERT_LON=0.0
|
||||||
|
-D ADMIN_PASSWORD='"password"'
|
||||||
|
-D ROOM_PASSWORD='"hello"'
|
||||||
|
; -D MESH_PACKET_LOGGING=1
|
||||||
|
; -D MESH_DEBUG=1
|
||||||
|
|
||||||
|
[env:Heltec_tower_v2_companion_radio_ble]
|
||||||
|
extends = Heltec_tower_v2
|
||||||
|
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||||
|
board_upload.maximum_size = 712704
|
||||||
|
build_flags =
|
||||||
|
${Heltec_tower_v2.build_flags}
|
||||||
|
-I examples/companion_radio/ui-new
|
||||||
|
-D DISPLAY_CLASS=NullDisplayDriver
|
||||||
|
-D MAX_CONTACTS=350
|
||||||
|
-D MAX_GROUP_CHANNELS=40
|
||||||
|
-D BLE_PIN_CODE=123456
|
||||||
|
; -D BLE_DEBUG_LOGGING=1
|
||||||
|
-D OFFLINE_QUEUE_SIZE=256
|
||||||
|
; -D MESH_PACKET_LOGGING=1
|
||||||
|
; -D MESH_DEBUG=1
|
||||||
|
build_src_filter = ${Heltec_tower_v2.build_src_filter}
|
||||||
|
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||||
|
+<../examples/companion_radio/*.cpp>
|
||||||
|
+<../examples/companion_radio/ui-new/*.cpp>
|
||||||
|
lib_deps =
|
||||||
|
${Heltec_tower_v2.lib_deps}
|
||||||
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
|
[env:Heltec_tower_v2_companion_radio_usb]
|
||||||
|
extends = Heltec_tower_v2
|
||||||
|
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||||
|
board_upload.maximum_size = 712704
|
||||||
|
build_flags =
|
||||||
|
${Heltec_tower_v2.build_flags}
|
||||||
|
-I examples/companion_radio/ui-new
|
||||||
|
-D DISPLAY_CLASS=NullDisplayDriver
|
||||||
|
-D MAX_CONTACTS=350
|
||||||
|
-D MAX_GROUP_CHANNELS=40
|
||||||
|
; -D BLE_PIN_CODE=123456
|
||||||
|
; -D BLE_DEBUG_LOGGING=1
|
||||||
|
; -D MESH_PACKET_LOGGING=1
|
||||||
|
; -D MESH_DEBUG=1
|
||||||
|
build_src_filter = ${Heltec_tower_v2.build_src_filter}
|
||||||
|
+<helpers/nrf52/*.cpp>
|
||||||
|
+<../examples/companion_radio/*.cpp>
|
||||||
|
+<../examples/companion_radio/ui-new/*.cpp>
|
||||||
|
lib_deps =
|
||||||
|
${Heltec_tower_v2.lib_deps}
|
||||||
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
|
[env:Heltec_tower_v2_kiss_modem]
|
||||||
|
extends = Heltec_tower_v2
|
||||||
|
build_src_filter = ${Heltec_tower_v2.build_src_filter}
|
||||||
|
+<../examples/kiss_modem/>
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#include "target.h"
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <helpers/ArduinoHelpers.h>
|
||||||
|
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||||
|
|
||||||
|
HeltecTowerV2Board board;
|
||||||
|
|
||||||
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
||||||
|
|
||||||
|
WRAPPER_CLASS radio_driver(radio, board);
|
||||||
|
|
||||||
|
VolatileRTCClock fallback_clock;
|
||||||
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
|
||||||
|
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
|
||||||
|
|
||||||
|
#ifdef DISPLAY_CLASS
|
||||||
|
DISPLAY_CLASS display;
|
||||||
|
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool radio_init() {
|
||||||
|
rtc_clock.begin(Wire);
|
||||||
|
return radio.std_init(&SPI);
|
||||||
|
}
|
||||||
|
|
||||||
|
mesh::LocalIdentity radio_new_identity() {
|
||||||
|
RadioNoiseListener rng(radio);
|
||||||
|
return mesh::LocalIdentity(&rng);
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define RADIOLIB_STATIC_ONLY 1
|
||||||
|
#include <RadioLib.h>
|
||||||
|
#include <HeltecTowerV2Board.h>
|
||||||
|
#include <helpers/AutoDiscoverRTCClock.h>
|
||||||
|
#include <helpers/radiolib/CustomSX1262Wrapper.h>
|
||||||
|
#include <helpers/radiolib/RadioLibWrappers.h>
|
||||||
|
#include <helpers/sensors/EnvironmentSensorManager.h>
|
||||||
|
#include <helpers/sensors/LocationProvider.h>
|
||||||
|
|
||||||
|
#ifdef DISPLAY_CLASS
|
||||||
|
#include <helpers/ui/MomentaryButton.h>
|
||||||
|
#include "helpers/ui/NullDisplayDriver.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern HeltecTowerV2Board board;
|
||||||
|
extern WRAPPER_CLASS radio_driver;
|
||||||
|
extern AutoDiscoverRTCClock rtc_clock;
|
||||||
|
extern EnvironmentSensorManager sensors;
|
||||||
|
|
||||||
|
#ifdef DISPLAY_CLASS
|
||||||
|
extern DISPLAY_CLASS display;
|
||||||
|
extern MomentaryButton user_btn;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool radio_init();
|
||||||
|
mesh::LocalIdentity radio_new_identity();
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#include "variant.h"
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "nrf.h"
|
||||||
|
#include "wiring_constants.h"
|
||||||
|
#include "wiring_digital.h"
|
||||||
|
|
||||||
|
const uint32_t g_ADigitalPinMap[] = {
|
||||||
|
0xff, 0xff, 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, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
|
||||||
|
40, 41, 42, 43, 44, 45, 46, 47
|
||||||
|
};
|
||||||
|
|
||||||
|
void initVariant()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void variant_shutdown()
|
||||||
|
{
|
||||||
|
nrf_gpio_cfg_default(PIN_GPS_EN);
|
||||||
|
nrf_gpio_cfg_default(PIN_GPS_PPS);
|
||||||
|
nrf_gpio_cfg_default(PIN_GPS_RESET);
|
||||||
|
nrf_gpio_cfg_default(PIN_GPS_STANDBY);
|
||||||
|
nrf_gpio_cfg_default(GPS_RX_PIN);
|
||||||
|
nrf_gpio_cfg_default(GPS_TX_PIN);
|
||||||
|
pinMode(LORA_KCT8103L_EN, OUTPUT);
|
||||||
|
digitalWrite(LORA_KCT8103L_EN, LOW);
|
||||||
|
nrf_gpio_cfg_default(LORA_KCT8103L_TX_RX);
|
||||||
|
nrf_gpio_cfg_default(RF_PA_DETECT_PIN);
|
||||||
|
nrf_gpio_cfg_default(SX126X_CS);
|
||||||
|
nrf_gpio_cfg_default(SX126X_DIO1);
|
||||||
|
nrf_gpio_cfg_default(SX126X_BUSY);
|
||||||
|
nrf_gpio_cfg_default(SX126X_RESET);
|
||||||
|
nrf_gpio_cfg_default(PIN_SPI_MISO);
|
||||||
|
nrf_gpio_cfg_default(PIN_SPI_MOSI);
|
||||||
|
nrf_gpio_cfg_default(PIN_SPI_SCK);
|
||||||
|
nrf_gpio_cfg_default(PIN_LED);
|
||||||
|
detachInterrupt(PIN_GPS_PPS);
|
||||||
|
detachInterrupt(PIN_BUTTON1);
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "WVariant.h"
|
||||||
|
|
||||||
|
#define USE_LFXO
|
||||||
|
#define VARIANT_MCK (64000000ul)
|
||||||
|
|
||||||
|
#define PINS_COUNT (48)
|
||||||
|
#define NUM_DIGITAL_PINS (48)
|
||||||
|
#define NUM_ANALOG_INPUTS (1)
|
||||||
|
#define NUM_ANALOG_OUTPUTS (0)
|
||||||
|
|
||||||
|
#define WIRE_INTERFACES_COUNT (1)
|
||||||
|
#define PIN_WIRE_SDA (0 + 30)
|
||||||
|
#define PIN_WIRE_SCL (0 + 5)
|
||||||
|
#define PIN_BOARD_SDA PIN_WIRE_SDA
|
||||||
|
#define PIN_BOARD_SCL PIN_WIRE_SCL
|
||||||
|
|
||||||
|
#define SPI_INTERFACES_COUNT (1)
|
||||||
|
#define PIN_SPI_MISO (0 + 23)
|
||||||
|
#define PIN_SPI_MOSI (0 + 22)
|
||||||
|
#define PIN_SPI_SCK (0 + 19)
|
||||||
|
#define PIN_SPI_NSS LORA_CS
|
||||||
|
|
||||||
|
#define LED_BUILTIN (32 + 15)
|
||||||
|
#define PIN_LED LED_BUILTIN
|
||||||
|
#define LED_RED (-1)
|
||||||
|
#define LED_GREEN (-1)
|
||||||
|
#define LED_BLUE (-1)
|
||||||
|
#define LED_PIN (-1)
|
||||||
|
#define P_LORA_TX_LED LED_BUILTIN
|
||||||
|
#define LED_STATE_ON LOW
|
||||||
|
|
||||||
|
#define PIN_BUTTON1 (32 + 10)
|
||||||
|
#define BUTTON_PIN PIN_BUTTON1
|
||||||
|
#define PIN_USER_BTN BUTTON_PIN
|
||||||
|
|
||||||
|
#define USE_SX1262
|
||||||
|
#define SX126X_CS (0 + 24)
|
||||||
|
#define LORA_CS SX126X_CS
|
||||||
|
#define SX126X_DIO1 (0 + 20)
|
||||||
|
#define SX126X_BUSY (0 + 17)
|
||||||
|
#define SX126X_RESET (0 + 25)
|
||||||
|
#define SX126X_DIO2_AS_RF_SWITCH
|
||||||
|
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
||||||
|
|
||||||
|
#define P_LORA_NSS LORA_CS
|
||||||
|
#define P_LORA_DIO_1 SX126X_DIO1
|
||||||
|
#define P_LORA_BUSY SX126X_BUSY
|
||||||
|
#define P_LORA_RESET SX126X_RESET
|
||||||
|
#define P_LORA_MISO PIN_SPI_MISO
|
||||||
|
#define P_LORA_MOSI PIN_SPI_MOSI
|
||||||
|
#define P_LORA_SCLK PIN_SPI_SCK
|
||||||
|
|
||||||
|
#define USE_KCT8103L_PA_ONLY
|
||||||
|
#define LORA_KCT8103L_EN (0 + 15)
|
||||||
|
#define LORA_KCT8103L_TX_RX (0 + 16)
|
||||||
|
#define LORA_PA_POWER LORA_KCT8103L_EN
|
||||||
|
#define RF_PA_DETECT_PIN (0 + 13)
|
||||||
|
#define RF_PA_HIGH_POWER_VALUE HIGH
|
||||||
|
|
||||||
|
#define GPS_L76K
|
||||||
|
#define GPS_RESET_MODE LOW
|
||||||
|
#define PIN_GPS_RESET (32 + 6)
|
||||||
|
#define PIN_GPS_RESET_ACTIVE GPS_RESET_MODE
|
||||||
|
#define PIN_GPS_EN (0 + 7)
|
||||||
|
#define PIN_GPS_EN_ACTIVE LOW
|
||||||
|
#define GPS_EN_ACTIVE PIN_GPS_EN_ACTIVE
|
||||||
|
#define PIN_GPS_STANDBY (32 + 2)
|
||||||
|
#define PIN_GPS_PPS (32 + 4)
|
||||||
|
#define GPS_BAUD_RATE 9600
|
||||||
|
|
||||||
|
// Upstream names are from the GPS perspective. MeshCore's PIN_GPS_TX is the
|
||||||
|
// CPU RX pin because EnvironmentSensorManager passes it as Serial1 RX.
|
||||||
|
#define GPS_TX_PIN (32 + 7)
|
||||||
|
#define GPS_RX_PIN (32 + 5)
|
||||||
|
#define PIN_GPS_TX GPS_RX_PIN
|
||||||
|
#define PIN_GPS_RX GPS_TX_PIN
|
||||||
|
|
||||||
|
#define PIN_SERIAL1_RX PIN_GPS_TX
|
||||||
|
#define PIN_SERIAL1_TX PIN_GPS_RX
|
||||||
|
#define PIN_SERIAL2_RX (-1)
|
||||||
|
#define PIN_SERIAL2_TX (-1)
|
||||||
|
|
||||||
|
#define HAS_HARDWARE_WATCHDOG
|
||||||
|
#define HARDWARE_WATCHDOG_DONE (0 + 9)
|
||||||
|
#define HARDWARE_WATCHDOG_WAKE (0 + 10)
|
||||||
|
#define HARDWARE_WATCHDOG_TIMEOUT_MS (8 * 60 * 1000)
|
||||||
|
|
||||||
|
#define SERIAL_PRINT_PORT 0
|
||||||
|
|
||||||
|
#define PIN_BAT_CTL (0 + 21)
|
||||||
|
#define ADC_CTRL PIN_BAT_CTL
|
||||||
|
#define ADC_CTRL_ENABLED HIGH
|
||||||
|
#define BATTERY_PIN (0 + 4)
|
||||||
|
#define PIN_VBAT_READ BATTERY_PIN
|
||||||
|
#define ADC_RESOLUTION 14
|
||||||
|
#define BATTERY_SENSE_RESOLUTION_BITS 12
|
||||||
|
#define BATTERY_SENSE_RESOLUTION 4096.0
|
||||||
|
#define AREF_VOLTAGE 3.0
|
||||||
|
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
|
||||||
|
#define ADC_MULTIPLIER (4.916F)
|
||||||
|
#define MV_LSB (3000.0F / 4096.0F)
|
||||||
|
|
||||||
|
#define NRF52_POWER_MANAGEMENT
|
||||||
|
#define PWRMGT_VOLTAGE_BOOTLOCK 3100
|
||||||
|
#define PWRMGT_LPCOMP_AIN 2
|
||||||
|
#define PWRMGT_LPCOMP_REFSEL 1
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
[Mesh_pocket]
|
[Mesh_pocket]
|
||||||
extends = nrf52_base
|
extends = nrf52_base
|
||||||
board = heltec_mesh_pocket
|
board = heltec_mesh_pocket
|
||||||
platform_packages = framework-arduinoadafruitnrf52
|
|
||||||
board_build.ldscript = boards/nrf52840_s140_v6.ld
|
board_build.ldscript = boards/nrf52840_s140_v6.ld
|
||||||
build_flags = ${nrf52_base.build_flags}
|
build_flags = ${nrf52_base.build_flags}
|
||||||
-I src/helpers/nrf52
|
-I src/helpers/nrf52
|
||||||
@@ -32,7 +31,6 @@ lib_deps =
|
|||||||
stevemarple/MicroNMEA @ ^2.0.6
|
stevemarple/MicroNMEA @ ^2.0.6
|
||||||
zinggjm/GxEPD2 @ 1.6.2
|
zinggjm/GxEPD2 @ 1.6.2
|
||||||
bakercp/CRC32 @ ^2.0.0
|
bakercp/CRC32 @ ^2.0.0
|
||||||
|
|
||||||
debug_tool = jlink
|
debug_tool = jlink
|
||||||
upload_protocol = nrfutil
|
upload_protocol = nrfutil
|
||||||
|
|
||||||
@@ -40,7 +38,6 @@ upload_protocol = nrfutil
|
|||||||
extends = Mesh_pocket
|
extends = Mesh_pocket
|
||||||
build_src_filter = ${Mesh_pocket.build_src_filter}
|
build_src_filter = ${Mesh_pocket.build_src_filter}
|
||||||
+<../examples/simple_repeater>
|
+<../examples/simple_repeater>
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${Mesh_pocket.build_flags}
|
${Mesh_pocket.build_flags}
|
||||||
-D ADVERT_NAME='"Heltec_Mesh_Pocket Repeater"'
|
-D ADVERT_NAME='"Heltec_Mesh_Pocket Repeater"'
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ lib_deps =
|
|||||||
adafruit/Adafruit SSD1306 @ ^2.5.13
|
adafruit/Adafruit SSD1306 @ ^2.5.13
|
||||||
adafruit/Adafruit NeoPixel @ ^1.12.3
|
adafruit/Adafruit NeoPixel @ ^1.12.3
|
||||||
|
|
||||||
[env:nibble_screen_connect_repeater]
|
[env:nibble_screen_connect_repeater_]
|
||||||
extends = nibble_screen_connect_base
|
extends = nibble_screen_connect_base
|
||||||
build_flags =
|
build_flags =
|
||||||
${nibble_screen_connect_base.build_flags}
|
${nibble_screen_connect_base.build_flags}
|
||||||
@@ -51,7 +51,7 @@ lib_deps =
|
|||||||
${nibble_screen_connect_base.lib_deps}
|
${nibble_screen_connect_base.lib_deps}
|
||||||
${esp32_ota.lib_deps}
|
${esp32_ota.lib_deps}
|
||||||
|
|
||||||
[env:nibble_screen_connect_repeater_bridge_espnow]
|
[env:nibble_screen_connect_repeater_bridge_espnow_]
|
||||||
extends = nibble_screen_connect_base
|
extends = nibble_screen_connect_base
|
||||||
build_flags =
|
build_flags =
|
||||||
${nibble_screen_connect_base.build_flags}
|
${nibble_screen_connect_base.build_flags}
|
||||||
@@ -70,7 +70,7 @@ lib_deps =
|
|||||||
${nibble_screen_connect_base.lib_deps}
|
${nibble_screen_connect_base.lib_deps}
|
||||||
${esp32_ota.lib_deps}
|
${esp32_ota.lib_deps}
|
||||||
|
|
||||||
[env:nibble_screen_connect_terminal_chat]
|
[env:nibble_screen_connect_terminal_chat_]
|
||||||
extends = nibble_screen_connect_base
|
extends = nibble_screen_connect_base
|
||||||
build_flags =
|
build_flags =
|
||||||
${nibble_screen_connect_base.build_flags}
|
${nibble_screen_connect_base.build_flags}
|
||||||
@@ -82,7 +82,7 @@ lib_deps =
|
|||||||
${nibble_screen_connect_base.lib_deps}
|
${nibble_screen_connect_base.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
[env:nibble_screen_connect_room_server]
|
[env:nibble_screen_connect_room_server_]
|
||||||
extends = nibble_screen_connect_base
|
extends = nibble_screen_connect_base
|
||||||
build_flags =
|
build_flags =
|
||||||
${nibble_screen_connect_base.build_flags}
|
${nibble_screen_connect_base.build_flags}
|
||||||
@@ -99,7 +99,7 @@ lib_deps =
|
|||||||
${nibble_screen_connect_base.lib_deps}
|
${nibble_screen_connect_base.lib_deps}
|
||||||
${esp32_ota.lib_deps}
|
${esp32_ota.lib_deps}
|
||||||
|
|
||||||
[env:nibble_screen_connect_companion_radio_usb]
|
[env:nibble_screen_connect_companion_radio_usb_]
|
||||||
extends = nibble_screen_connect_base
|
extends = nibble_screen_connect_base
|
||||||
build_flags =
|
build_flags =
|
||||||
${nibble_screen_connect_base.build_flags}
|
${nibble_screen_connect_base.build_flags}
|
||||||
@@ -116,7 +116,7 @@ lib_deps =
|
|||||||
${nibble_screen_connect_base.lib_deps}
|
${nibble_screen_connect_base.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
[env:nibble_screen_connect_companion_radio_ble]
|
[env:nibble_screen_connect_companion_radio_ble_]
|
||||||
extends = nibble_screen_connect_base
|
extends = nibble_screen_connect_base
|
||||||
build_flags =
|
build_flags =
|
||||||
${nibble_screen_connect_base.build_flags}
|
${nibble_screen_connect_base.build_flags}
|
||||||
@@ -137,7 +137,7 @@ lib_deps =
|
|||||||
${nibble_screen_connect_base.lib_deps}
|
${nibble_screen_connect_base.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
[env:nibble_screen_connect_companion_radio_wifi]
|
[env:nibble_screen_connect_companion_radio_wifi_]
|
||||||
extends = nibble_screen_connect_base
|
extends = nibble_screen_connect_base
|
||||||
build_flags =
|
build_flags =
|
||||||
${nibble_screen_connect_base.build_flags}
|
${nibble_screen_connect_base.build_flags}
|
||||||
@@ -160,7 +160,7 @@ lib_deps =
|
|||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
|
|
||||||
[env:nibble_screen_connect_kiss_modem]
|
[env:nibble_screen_connect_kiss_modem_]
|
||||||
extends = nibble_screen_connect_base
|
extends = nibble_screen_connect_base
|
||||||
build_src_filter = ${nibble_screen_connect_base.build_src_filter}
|
build_src_filter = ${nibble_screen_connect_base.build_src_filter}
|
||||||
+<../examples/kiss_modem/>
|
+<../examples/kiss_modem/>
|
||||||
|
|||||||
@@ -0,0 +1,158 @@
|
|||||||
|
[nibble_zero_connect_base]
|
||||||
|
extends = esp32_base
|
||||||
|
board = esp32-s3-zero
|
||||||
|
build_flags =
|
||||||
|
${esp32_base.build_flags}
|
||||||
|
-I variants/nibble_zero_connect
|
||||||
|
-D NIBBLE_ZERO_CONNECT
|
||||||
|
-D P_LORA_DIO_1=4
|
||||||
|
-D P_LORA_NSS=10
|
||||||
|
-D P_LORA_RESET=6
|
||||||
|
-D P_LORA_BUSY=5
|
||||||
|
-D P_LORA_SCLK=12
|
||||||
|
-D P_LORA_MISO=13
|
||||||
|
-D P_LORA_MOSI=11
|
||||||
|
-D PIN_USER_BTN=1
|
||||||
|
-D PIN_BOARD_SDA=8
|
||||||
|
-D PIN_BOARD_SCL=7
|
||||||
|
-D PIN_STATUS_LED=39
|
||||||
|
-D P_LORA_TX_LED=39
|
||||||
|
-D DISPLAY_ROTATION=0
|
||||||
|
-D SX126X_DIO2_AS_RF_SWITCH=true
|
||||||
|
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
|
||||||
|
-D SX126X_CURRENT_LIMIT=140
|
||||||
|
-D RADIO_CLASS=CustomSX1262
|
||||||
|
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||||
|
-D LORA_TX_POWER=22
|
||||||
|
-D SX126X_RX_BOOSTED_GAIN=1
|
||||||
|
build_src_filter = ${esp32_base.build_src_filter}
|
||||||
|
+<../variants/nibble_zero_connect>
|
||||||
|
lib_deps =
|
||||||
|
${esp32_base.lib_deps}
|
||||||
|
adafruit/Adafruit SSD1306 @ ^2.5.13
|
||||||
|
|
||||||
|
[env:nibble_zero_connect_repeater_]
|
||||||
|
extends = nibble_zero_connect_base
|
||||||
|
build_flags =
|
||||||
|
${nibble_zero_connect_base.build_flags}
|
||||||
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
|
-D ADVERT_NAME='"Nibble Repeater"'
|
||||||
|
-D ADVERT_LAT=0.0
|
||||||
|
-D ADVERT_LON=0.0
|
||||||
|
-D ADMIN_PASSWORD='"password"'
|
||||||
|
-D MAX_NEIGHBOURS=50
|
||||||
|
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
|
||||||
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
|
+<../examples/simple_repeater>
|
||||||
|
lib_deps =
|
||||||
|
${nibble_zero_connect_base.lib_deps}
|
||||||
|
${esp32_ota.lib_deps}
|
||||||
|
|
||||||
|
[env:nibble_zero_connect_repeater_bridge_espnow_]
|
||||||
|
extends = nibble_zero_connect_base
|
||||||
|
build_flags =
|
||||||
|
${nibble_zero_connect_base.build_flags}
|
||||||
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
|
-D ADVERT_NAME='"ESPNow Bridge"'
|
||||||
|
-D ADVERT_LAT=0.0
|
||||||
|
-D ADVERT_LON=0.0
|
||||||
|
-D ADMIN_PASSWORD='"password"'
|
||||||
|
-D MAX_NEIGHBOURS=50
|
||||||
|
-D WITH_ESPNOW_BRIDGE=1
|
||||||
|
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
|
||||||
|
+<helpers/bridges/ESPNowBridge.cpp>
|
||||||
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
|
+<../examples/simple_repeater>
|
||||||
|
lib_deps =
|
||||||
|
${nibble_zero_connect_base.lib_deps}
|
||||||
|
${esp32_ota.lib_deps}
|
||||||
|
|
||||||
|
[env:nibble_zero_connect_terminal_chat_]
|
||||||
|
extends = nibble_zero_connect_base
|
||||||
|
build_flags =
|
||||||
|
${nibble_zero_connect_base.build_flags}
|
||||||
|
-D MAX_CONTACTS=300
|
||||||
|
-D MAX_GROUP_CHANNELS=1
|
||||||
|
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
|
||||||
|
+<../examples/simple_secure_chat/main.cpp>
|
||||||
|
lib_deps =
|
||||||
|
${nibble_zero_connect_base.lib_deps}
|
||||||
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
|
[env:nibble_zero_connect_room_server_]
|
||||||
|
extends = nibble_zero_connect_base
|
||||||
|
build_flags =
|
||||||
|
${nibble_zero_connect_base.build_flags}
|
||||||
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
|
-D ADVERT_NAME='"Nibble Room"'
|
||||||
|
-D ADVERT_LAT=0.0
|
||||||
|
-D ADVERT_LON=0.0
|
||||||
|
-D ADMIN_PASSWORD='"password"'
|
||||||
|
-D ROOM_PASSWORD='"hello"'
|
||||||
|
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
|
||||||
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
|
+<../examples/simple_room_server>
|
||||||
|
lib_deps =
|
||||||
|
${nibble_zero_connect_base.lib_deps}
|
||||||
|
${esp32_ota.lib_deps}
|
||||||
|
|
||||||
|
[env:nibble_zero_connect_companion_radio_usb_]
|
||||||
|
extends = nibble_zero_connect_base
|
||||||
|
build_flags =
|
||||||
|
${nibble_zero_connect_base.build_flags}
|
||||||
|
-I examples/companion_radio/ui-new
|
||||||
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
|
-D MAX_CONTACTS=300
|
||||||
|
-D MAX_GROUP_CHANNELS=8
|
||||||
|
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
|
||||||
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
|
+<helpers/ui/MomentaryButton.cpp>
|
||||||
|
+<../examples/companion_radio/*.cpp>
|
||||||
|
+<../examples/companion_radio/ui-new/*.cpp>
|
||||||
|
lib_deps =
|
||||||
|
${nibble_zero_connect_base.lib_deps}
|
||||||
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
|
[env:nibble_zero_connect_companion_radio_ble_]
|
||||||
|
extends = nibble_zero_connect_base
|
||||||
|
build_flags =
|
||||||
|
${nibble_zero_connect_base.build_flags}
|
||||||
|
-I examples/companion_radio/ui-new
|
||||||
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
|
-D MAX_CONTACTS=300
|
||||||
|
-D MAX_GROUP_CHANNELS=8
|
||||||
|
-D BLE_PIN_CODE=123456
|
||||||
|
-D BLE_DEBUG_LOGGING=1
|
||||||
|
-D OFFLINE_QUEUE_SIZE=256
|
||||||
|
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
|
||||||
|
+<helpers/esp32/*.cpp>
|
||||||
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
|
+<helpers/ui/MomentaryButton.cpp>
|
||||||
|
+<../examples/companion_radio/*.cpp>
|
||||||
|
+<../examples/companion_radio/ui-new/*.cpp>
|
||||||
|
lib_deps =
|
||||||
|
${nibble_zero_connect_base.lib_deps}
|
||||||
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
|
[env:nibble_zero_connect_companion_radio_wifi_]
|
||||||
|
extends = nibble_zero_connect_base
|
||||||
|
build_flags =
|
||||||
|
${nibble_zero_connect_base.build_flags}
|
||||||
|
-I examples/companion_radio/ui-new
|
||||||
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
|
-D MAX_CONTACTS=300
|
||||||
|
-D MAX_GROUP_CHANNELS=8
|
||||||
|
-D WIFI_DEBUG_LOGGING=1
|
||||||
|
-D WIFI_SSID='"myssid"'
|
||||||
|
-D WIFI_PWD='"mypwd"'
|
||||||
|
build_src_filter = ${nibble_zero_connect_base.build_src_filter}
|
||||||
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
|
+<helpers/ui/MomentaryButton.cpp>
|
||||||
|
+<helpers/esp32/*.cpp>
|
||||||
|
+<../examples/companion_radio/*.cpp>
|
||||||
|
+<../examples/companion_radio/ui-new/*.cpp>
|
||||||
|
lib_deps =
|
||||||
|
${nibble_zero_connect_base.lib_deps}
|
||||||
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
#include <Arduino.h>
|
||||||
|
#include "target.h"
|
||||||
|
|
||||||
|
ESP32Board board;
|
||||||
|
|
||||||
|
static SPIClass spi;
|
||||||
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);
|
||||||
|
WRAPPER_CLASS radio_driver(radio, board);
|
||||||
|
|
||||||
|
ESP32RTCClock fallback_clock;
|
||||||
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
|
SensorManager sensors;
|
||||||
|
|
||||||
|
#ifdef DISPLAY_CLASS
|
||||||
|
DISPLAY_CLASS display;
|
||||||
|
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LORA_CR
|
||||||
|
#define LORA_CR 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool radio_init() {
|
||||||
|
fallback_clock.begin();
|
||||||
|
rtc_clock.begin(Wire);
|
||||||
|
|
||||||
|
return radio.std_init(&spi);
|
||||||
|
}
|
||||||
|
|
||||||
|
mesh::LocalIdentity radio_new_identity() {
|
||||||
|
RadioNoiseListener rng(radio);
|
||||||
|
return mesh::LocalIdentity(&rng);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define RADIOLIB_STATIC_ONLY 1
|
||||||
|
#include <RadioLib.h>
|
||||||
|
#include <helpers/radiolib/RadioLibWrappers.h>
|
||||||
|
#include <helpers/ESP32Board.h>
|
||||||
|
#include <helpers/radiolib/CustomSX1262Wrapper.h>
|
||||||
|
#include <helpers/AutoDiscoverRTCClock.h>
|
||||||
|
#include <helpers/SensorManager.h>
|
||||||
|
#ifdef DISPLAY_CLASS
|
||||||
|
#include <helpers/ui/SSD1306Display.h>
|
||||||
|
#include <helpers/ui/MomentaryButton.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern ESP32Board board;
|
||||||
|
extern WRAPPER_CLASS radio_driver;
|
||||||
|
extern AutoDiscoverRTCClock rtc_clock;
|
||||||
|
extern SensorManager sensors;
|
||||||
|
|
||||||
|
#ifdef DISPLAY_CLASS
|
||||||
|
extern DISPLAY_CLASS display;
|
||||||
|
extern MomentaryButton user_btn;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool radio_init();
|
||||||
|
mesh::LocalIdentity radio_new_identity();
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
[Xiao_C6]
|
[Xiao_C6]
|
||||||
extends = esp32c6_base
|
extends = esp32c6_base
|
||||||
board = esp32-c6-devkitm-1
|
board = esp32-c6-devkitm-1
|
||||||
|
board_build.flash_mode = dio
|
||||||
board_build.partitions = min_spiffs.csv ; get around 4mb flash limit
|
board_build.partitions = min_spiffs.csv ; get around 4mb flash limit
|
||||||
build_flags =
|
build_flags =
|
||||||
${esp32c6_base.build_flags}
|
${esp32c6_base.build_flags}
|
||||||
|
|||||||
Reference in New Issue
Block a user