Compare commits
28 Commits
meshcore-e
...
v0.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14c00ace72 | ||
|
|
e81ce6158e | ||
|
|
c9d6927d26 | ||
|
|
0b947f9d1b | ||
|
|
1798e44f01 | ||
|
|
4fd7aa6ce8 | ||
|
|
4643f4d3a3 | ||
|
|
77257a376b | ||
|
|
324eab9394 | ||
|
|
266e4893fd | ||
|
|
bafbfaf2b5 | ||
|
|
69a71d0e25 | ||
|
|
b6110eee38 | ||
|
|
4e4f6d92a0 | ||
|
|
65796c8f20 | ||
|
|
fd69acb421 | ||
|
|
2a035ad816 | ||
|
|
5475043083 | ||
|
|
5cc44dd802 | ||
|
|
8d51126956 | ||
|
|
3af25495bb | ||
|
|
e563529cc5 | ||
|
|
09a20d72e7 | ||
|
|
14f00fe688 | ||
|
|
ce3b6e67f9 | ||
|
|
3a497a4b99 | ||
|
|
5871c69f6f | ||
|
|
802de27e03 |
@@ -103,7 +103,9 @@ Request type
|
|||||||
| `0x02` | keepalive | (deprecated) |
|
| `0x02` | keepalive | (deprecated) |
|
||||||
| `0x03` | get telemetry data | TODO |
|
| `0x03` | get telemetry data | TODO |
|
||||||
| `0x04` | get min,max,avg data | sensor nodes - get min, max, average for given time span |
|
| `0x04` | get min,max,avg data | sensor nodes - get min, max, average for given time span |
|
||||||
| `0x05` | get access list | get node's approved access list |
|
| `0x05` | get access list | get node's approved access list |
|
||||||
|
| `0x06` | get neighbors | get repeater node's neighbors |
|
||||||
|
| `0x07` | get owner info | get repeater firmware-ver/name/owner info |
|
||||||
|
|
||||||
### Get stats
|
### Get stats
|
||||||
|
|
||||||
@@ -132,6 +134,27 @@ Gets information about the node, possibly including the following:
|
|||||||
|
|
||||||
Request data about sensors on the node, including battery level.
|
Request data about sensors on the node, including battery level.
|
||||||
|
|
||||||
|
### Get Telemetry
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
### Get Min/Max/Ave (Sensor nodes)
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
### Get Access List
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
### Get Neighors
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
### Get Owner Info
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
|
||||||
## Response
|
## Response
|
||||||
|
|
||||||
| Field | Size (bytes) | Description |
|
| Field | Size (bytes) | Description |
|
||||||
@@ -179,6 +202,34 @@ txt_type
|
|||||||
| timestamp | 4 | sender time (unix timestamp) |
|
| timestamp | 4 | sender time (unix timestamp) |
|
||||||
| password | rest of message | password for repeater/sensor |
|
| password | rest of message | password for repeater/sensor |
|
||||||
|
|
||||||
|
## Repeater - Regions request
|
||||||
|
|
||||||
|
| Field | Size (bytes) | Description |
|
||||||
|
|----------------|-----------------|-------------------------------------------------------------------------------|
|
||||||
|
| timestamp | 4 | sender time (unix timestamp) |
|
||||||
|
| req type | 1 | 0x01 (request sub type) |
|
||||||
|
| reply path len | 1 | path len for reply |
|
||||||
|
| reply path | (variable) | reply path |
|
||||||
|
|
||||||
|
## Repeater - Owner info request
|
||||||
|
|
||||||
|
| Field | Size (bytes) | Description |
|
||||||
|
|----------------|-----------------|-------------------------------------------------------------------------------|
|
||||||
|
| timestamp | 4 | sender time (unix timestamp) |
|
||||||
|
| req type | 1 | 0x02 (request sub type) |
|
||||||
|
| reply path len | 1 | path len for reply |
|
||||||
|
| reply path | (variable) | reply path |
|
||||||
|
|
||||||
|
## Repeater - Clock and status request
|
||||||
|
|
||||||
|
| Field | Size (bytes) | Description |
|
||||||
|
|----------------|-----------------|-------------------------------------------------------------------------------|
|
||||||
|
| timestamp | 4 | sender time (unix timestamp) |
|
||||||
|
| req type | 1 | 0x03 (request sub type) |
|
||||||
|
| reply path len | 1 | path len for reply |
|
||||||
|
| reply path | (variable) | reply path |
|
||||||
|
|
||||||
|
|
||||||
# Group text message / datagram
|
# Group text message / datagram
|
||||||
|
|
||||||
| Field | Size (bytes) | Description |
|
| Field | Size (bytes) | Description |
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
#define CMD_SET_FLOOD_SCOPE 54 // v8+
|
#define CMD_SET_FLOOD_SCOPE 54 // v8+
|
||||||
#define CMD_SEND_CONTROL_DATA 55 // v8+
|
#define CMD_SEND_CONTROL_DATA 55 // v8+
|
||||||
#define CMD_GET_STATS 56 // v8+, second byte is stats type
|
#define CMD_GET_STATS 56 // v8+, second byte is stats type
|
||||||
|
#define CMD_SEND_ANON_REQ 57
|
||||||
|
|
||||||
// Stats sub-types for CMD_GET_STATS
|
// Stats sub-types for CMD_GET_STATS
|
||||||
#define STATS_TYPE_CORE 0
|
#define STATS_TYPE_CORE 0
|
||||||
@@ -1286,6 +1287,27 @@ void MyMesh::handleCmdFrame(size_t len) {
|
|||||||
} else {
|
} else {
|
||||||
writeErrFrame(ERR_CODE_NOT_FOUND); // contact not found
|
writeErrFrame(ERR_CODE_NOT_FOUND); // contact not found
|
||||||
}
|
}
|
||||||
|
} else if (cmd_frame[0] == CMD_SEND_ANON_REQ && len > 1 + PUB_KEY_SIZE) {
|
||||||
|
uint8_t *pub_key = &cmd_frame[1];
|
||||||
|
ContactInfo *recipient = lookupContactByPubKey(pub_key, PUB_KEY_SIZE);
|
||||||
|
uint8_t *data = &cmd_frame[1 + PUB_KEY_SIZE];
|
||||||
|
if (recipient) {
|
||||||
|
uint32_t tag, est_timeout;
|
||||||
|
int result = sendAnonReq(*recipient, data, len - (1 + PUB_KEY_SIZE), tag, est_timeout);
|
||||||
|
if (result == MSG_SEND_FAILED) {
|
||||||
|
writeErrFrame(ERR_CODE_TABLE_FULL);
|
||||||
|
} else {
|
||||||
|
clearPendingReqs();
|
||||||
|
pending_req = tag; // match this to onContactResponse()
|
||||||
|
out_frame[0] = RESP_CODE_SENT;
|
||||||
|
out_frame[1] = (result == MSG_SEND_SENT_FLOOD) ? 1 : 0;
|
||||||
|
memcpy(&out_frame[2], &tag, 4);
|
||||||
|
memcpy(&out_frame[6], &est_timeout, 4);
|
||||||
|
_serial->writeFrame(out_frame, 10);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
writeErrFrame(ERR_CODE_NOT_FOUND); // contact not found
|
||||||
|
}
|
||||||
} else if (cmd_frame[0] == CMD_SEND_STATUS_REQ && len >= 1 + PUB_KEY_SIZE) {
|
} else if (cmd_frame[0] == CMD_SEND_STATUS_REQ && len >= 1 + PUB_KEY_SIZE) {
|
||||||
uint8_t *pub_key = &cmd_frame[1];
|
uint8_t *pub_key = &cmd_frame[1];
|
||||||
ContactInfo *recipient = lookupContactByPubKey(pub_key, PUB_KEY_SIZE);
|
ContactInfo *recipient = lookupContactByPubKey(pub_key, PUB_KEY_SIZE);
|
||||||
|
|||||||
@@ -41,16 +41,21 @@
|
|||||||
#define TXT_ACK_DELAY 200
|
#define TXT_ACK_DELAY 200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FIRMWARE_VER_LEVEL 1
|
#define FIRMWARE_VER_LEVEL 2
|
||||||
|
|
||||||
#define REQ_TYPE_GET_STATUS 0x01 // same as _GET_STATS
|
#define REQ_TYPE_GET_STATUS 0x01 // same as _GET_STATS
|
||||||
#define REQ_TYPE_KEEP_ALIVE 0x02
|
#define REQ_TYPE_KEEP_ALIVE 0x02
|
||||||
#define REQ_TYPE_GET_TELEMETRY_DATA 0x03
|
#define REQ_TYPE_GET_TELEMETRY_DATA 0x03
|
||||||
#define REQ_TYPE_GET_ACCESS_LIST 0x05
|
#define REQ_TYPE_GET_ACCESS_LIST 0x05
|
||||||
#define REQ_TYPE_GET_NEIGHBOURS 0x06
|
#define REQ_TYPE_GET_NEIGHBOURS 0x06
|
||||||
|
#define REQ_TYPE_GET_OWNER_INFO 0x07 // FIRMWARE_VER_LEVEL >= 2
|
||||||
|
|
||||||
#define RESP_SERVER_LOGIN_OK 0 // response to ANON_REQ
|
#define RESP_SERVER_LOGIN_OK 0 // response to ANON_REQ
|
||||||
|
|
||||||
|
#define ANON_REQ_TYPE_REGIONS 0x01
|
||||||
|
#define ANON_REQ_TYPE_OWNER 0x02
|
||||||
|
#define ANON_REQ_TYPE_BASIC 0x03 // just remote clock
|
||||||
|
|
||||||
#define CLI_REPLY_DELAY_MILLIS 600
|
#define CLI_REPLY_DELAY_MILLIS 600
|
||||||
|
|
||||||
#define LAZY_CONTACTS_WRITE_DELAY 5000
|
#define LAZY_CONTACTS_WRITE_DELAY 5000
|
||||||
@@ -139,6 +144,64 @@ uint8_t MyMesh::handleLoginReq(const mesh::Identity& sender, const uint8_t* secr
|
|||||||
return 13; // reply length
|
return 13; // reply length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t MyMesh::handleAnonRegionsReq(const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t* data) {
|
||||||
|
if (anon_limiter.allow(rtc_clock.getCurrentTime())) {
|
||||||
|
// request data has: {reply-path-len}{reply-path}
|
||||||
|
reply_path_len = *data++ & 0x3F;
|
||||||
|
memcpy(reply_path, data, reply_path_len);
|
||||||
|
// data += reply_path_len;
|
||||||
|
|
||||||
|
memcpy(reply_data, &sender_timestamp, 4); // prefix with sender_timestamp, like a tag
|
||||||
|
uint32_t now = getRTCClock()->getCurrentTime();
|
||||||
|
memcpy(&reply_data[4], &now, 4); // include our clock (for easy clock sync, and packet hash uniqueness)
|
||||||
|
|
||||||
|
return 8 + region_map.exportNamesTo((char *) &reply_data[8], sizeof(reply_data) - 12, REGION_DENY_FLOOD); // reply length
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t MyMesh::handleAnonOwnerReq(const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t* data) {
|
||||||
|
if (anon_limiter.allow(rtc_clock.getCurrentTime())) {
|
||||||
|
// request data has: {reply-path-len}{reply-path}
|
||||||
|
reply_path_len = *data++ & 0x3F;
|
||||||
|
memcpy(reply_path, data, reply_path_len);
|
||||||
|
// data += reply_path_len;
|
||||||
|
|
||||||
|
memcpy(reply_data, &sender_timestamp, 4); // prefix with sender_timestamp, like a tag
|
||||||
|
uint32_t now = getRTCClock()->getCurrentTime();
|
||||||
|
memcpy(&reply_data[4], &now, 4); // include our clock (for easy clock sync, and packet hash uniqueness)
|
||||||
|
sprintf((char *) &reply_data[8], "%s\n%s", _prefs.node_name, _prefs.owner_info);
|
||||||
|
|
||||||
|
return 8 + strlen((char *) &reply_data[8]); // reply length
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t MyMesh::handleAnonClockReq(const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t* data) {
|
||||||
|
if (anon_limiter.allow(rtc_clock.getCurrentTime())) {
|
||||||
|
// request data has: {reply-path-len}{reply-path}
|
||||||
|
reply_path_len = *data++ & 0x3F;
|
||||||
|
memcpy(reply_path, data, reply_path_len);
|
||||||
|
// data += reply_path_len;
|
||||||
|
|
||||||
|
memcpy(reply_data, &sender_timestamp, 4); // prefix with sender_timestamp, like a tag
|
||||||
|
uint32_t now = getRTCClock()->getCurrentTime();
|
||||||
|
memcpy(&reply_data[4], &now, 4); // include our clock (for easy clock sync, and packet hash uniqueness)
|
||||||
|
reply_data[8] = 0; // features
|
||||||
|
#ifdef WITH_RS232_BRIDGE
|
||||||
|
reply_data[8] |= 0x01; // is bridge, type UART
|
||||||
|
#elif WITH_ESPNOW_BRIDGE
|
||||||
|
reply_data[8] |= 0x03; // is bridge, type ESP-NOW
|
||||||
|
#endif
|
||||||
|
if (_prefs.disable_fwd) { // is this repeater currently disabled
|
||||||
|
reply_data[8] |= 0x80; // is disabled
|
||||||
|
}
|
||||||
|
// TODO: add some kind of moving-window utilisation metric, so can query 'how busy' is this repeater
|
||||||
|
return 9; // reply length
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t *payload, size_t payload_len) {
|
int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t *payload, size_t payload_len) {
|
||||||
// uint32_t now = getRTCClock()->getCurrentTimeUnique();
|
// uint32_t now = getRTCClock()->getCurrentTimeUnique();
|
||||||
// memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
|
// memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
|
||||||
@@ -296,6 +359,9 @@ int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t
|
|||||||
|
|
||||||
return reply_offset;
|
return reply_offset;
|
||||||
}
|
}
|
||||||
|
} else if (payload[0] == REQ_TYPE_GET_OWNER_INFO) {
|
||||||
|
sprintf((char *) &reply_data[4], "%s\n%s\n%s", FIRMWARE_VERSION, _prefs.node_name, _prefs.owner_info);
|
||||||
|
return 4 + strlen((char *) &reply_data[4]);
|
||||||
}
|
}
|
||||||
return 0; // unknown command
|
return 0; // unknown command
|
||||||
}
|
}
|
||||||
@@ -324,6 +390,14 @@ bool MyMesh::allowPacketForward(const mesh::Packet *packet) {
|
|||||||
MESH_DEBUG_PRINTLN("allowPacketForward: unknown transport code, or wildcard not allowed for FLOOD packet");
|
MESH_DEBUG_PRINTLN("allowPacketForward: unknown transport code, or wildcard not allowed for FLOOD packet");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Limit flood advert paket forwarding using a probabilistic reduction defined by P(h) = 0.308^(hops-1)
|
||||||
|
// https://github.com/meshcore-dev/MeshCore/issues/1223
|
||||||
|
double_t roll_dice = (double)rand() / RAND_MAX;
|
||||||
|
double_t forw_prob = pow(_prefs.flood_advert_base, packet->path_len - 1);
|
||||||
|
if (packet->getPayloadType() == PAYLOAD_TYPE_ADVERT && packet->isRouteFlood() && roll_dice > forw_prob)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// all other packets
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,12 +522,18 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m
|
|||||||
|
|
||||||
data[len] = 0; // ensure null terminator
|
data[len] = 0; // ensure null terminator
|
||||||
uint8_t reply_len;
|
uint8_t reply_len;
|
||||||
|
|
||||||
|
reply_path_len = -1;
|
||||||
if (data[4] == 0 || data[4] >= ' ') { // is password, ie. a login request
|
if (data[4] == 0 || data[4] >= ' ') { // is password, ie. a login request
|
||||||
reply_len = handleLoginReq(sender, secret, timestamp, &data[4], packet->isRouteFlood());
|
reply_len = handleLoginReq(sender, secret, timestamp, &data[4], packet->isRouteFlood());
|
||||||
//} else if (data[4] == ANON_REQ_TYPE_*) { // future type codes
|
} else if (data[4] == ANON_REQ_TYPE_REGIONS && packet->isRouteDirect()) {
|
||||||
// TODO
|
reply_len = handleAnonRegionsReq(sender, timestamp, &data[5]);
|
||||||
|
} else if (data[4] == ANON_REQ_TYPE_OWNER && packet->isRouteDirect()) {
|
||||||
|
reply_len = handleAnonOwnerReq(sender, timestamp, &data[5]);
|
||||||
|
} else if (data[4] == ANON_REQ_TYPE_BASIC && packet->isRouteDirect()) {
|
||||||
|
reply_len = handleAnonClockReq(sender, timestamp, &data[5]);
|
||||||
} else {
|
} else {
|
||||||
reply_len = 0; // unknown request type
|
reply_len = 0; // unknown/invalid request type
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reply_len == 0) return; // invalid request
|
if (reply_len == 0) return; // invalid request
|
||||||
@@ -463,9 +543,12 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m
|
|||||||
mesh::Packet* path = createPathReturn(sender, secret, packet->path, packet->path_len,
|
mesh::Packet* path = createPathReturn(sender, secret, packet->path, packet->path_len,
|
||||||
PAYLOAD_TYPE_RESPONSE, reply_data, reply_len);
|
PAYLOAD_TYPE_RESPONSE, reply_data, reply_len);
|
||||||
if (path) sendFlood(path, SERVER_RESPONSE_DELAY);
|
if (path) sendFlood(path, SERVER_RESPONSE_DELAY);
|
||||||
} else {
|
} else if (reply_path_len < 0) {
|
||||||
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, secret, reply_data, reply_len);
|
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, secret, reply_data, reply_len);
|
||||||
if (reply) sendFlood(reply, SERVER_RESPONSE_DELAY);
|
if (reply) sendFlood(reply, SERVER_RESPONSE_DELAY);
|
||||||
|
} else {
|
||||||
|
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, secret, reply_data, reply_len);
|
||||||
|
if (reply) sendDirect(reply, reply_path, reply_path_len, SERVER_RESPONSE_DELAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -636,8 +719,16 @@ bool MyMesh::onPeerPathRecv(mesh::Packet *packet, int sender_idx, const uint8_t
|
|||||||
#define CTL_TYPE_NODE_DISCOVER_RESP 0x90
|
#define CTL_TYPE_NODE_DISCOVER_RESP 0x90
|
||||||
|
|
||||||
void MyMesh::onControlDataRecv(mesh::Packet* packet) {
|
void MyMesh::onControlDataRecv(mesh::Packet* packet) {
|
||||||
|
if (!packet->payload) {
|
||||||
|
MESH_DEBUG_PRINTLN("onControlDataRecv: packet->payload is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(STEALTH_MODE)
|
||||||
uint8_t type = packet->payload[0] & 0xF0; // just test upper 4 bits
|
uint8_t type = packet->payload[0] & 0xF0; // just test upper 4 bits
|
||||||
if (type == CTL_TYPE_NODE_DISCOVER_REQ && packet->payload_len >= 6 && discover_limiter.allow(rtc_clock.getCurrentTime())) {
|
if (type == CTL_TYPE_NODE_DISCOVER_REQ && packet->payload_len >= 6
|
||||||
|
&& !_prefs.disable_fwd && discover_limiter.allow(rtc_clock.getCurrentTime())
|
||||||
|
) {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
uint8_t filter = packet->payload[i++];
|
uint8_t filter = packet->payload[i++];
|
||||||
uint32_t tag;
|
uint32_t tag;
|
||||||
@@ -662,13 +753,15 @@ void MyMesh::onControlDataRecv(mesh::Packet* packet) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondClock &ms, mesh::RNG &rng,
|
MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondClock &ms, mesh::RNG &rng,
|
||||||
mesh::RTCClock &rtc, mesh::MeshTables &tables)
|
mesh::RTCClock &rtc, mesh::MeshTables &tables)
|
||||||
: mesh::Mesh(radio, ms, rng, rtc, *new StaticPoolPacketManager(32), tables),
|
: mesh::Mesh(radio, ms, rng, rtc, *new StaticPoolPacketManager(32), tables),
|
||||||
_cli(board, rtc, sensors, &_prefs, this), telemetry(MAX_PACKET_PAYLOAD - 4), region_map(key_store), temp_map(key_store),
|
_cli(board, rtc, sensors, &_prefs, this), telemetry(MAX_PACKET_PAYLOAD - 4), region_map(key_store), temp_map(key_store),
|
||||||
discover_limiter(4, 120) // max 4 every 2 minutes
|
discover_limiter(4, 120), // max 4 every 2 minutes
|
||||||
|
anon_limiter(4, 180) // max 4 every 3 minutes
|
||||||
#if defined(WITH_RS232_BRIDGE)
|
#if defined(WITH_RS232_BRIDGE)
|
||||||
, bridge(&_prefs, WITH_RS232_BRIDGE, _mgr, &rtc)
|
, bridge(&_prefs, WITH_RS232_BRIDGE, _mgr, &rtc)
|
||||||
#endif
|
#endif
|
||||||
@@ -703,8 +796,9 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
|
|||||||
_prefs.bw = LORA_BW;
|
_prefs.bw = LORA_BW;
|
||||||
_prefs.cr = LORA_CR;
|
_prefs.cr = LORA_CR;
|
||||||
_prefs.tx_power_dbm = LORA_TX_POWER;
|
_prefs.tx_power_dbm = LORA_TX_POWER;
|
||||||
_prefs.advert_interval = 1; // default to 2 minutes for NEW installs
|
_prefs.advert_interval = DEF_LOCAL_ADVERT_INTERVAL;
|
||||||
_prefs.flood_advert_interval = 12; // 12 hours
|
_prefs.flood_advert_interval = DEF_FLOOD_ADVERT_INTERVAL;
|
||||||
|
_prefs.flood_advert_base = 0.308f;
|
||||||
_prefs.flood_max = 64;
|
_prefs.flood_max = 64;
|
||||||
_prefs.interference_threshold = 0; // disabled
|
_prefs.interference_threshold = 0; // disabled
|
||||||
|
|
||||||
@@ -776,10 +870,14 @@ bool MyMesh::formatFileSystem() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyMesh::sendSelfAdvertisement(int delay_millis) {
|
void MyMesh::sendSelfAdvertisement(int delay_millis, bool flood) {
|
||||||
mesh::Packet *pkt = createSelfAdvert();
|
mesh::Packet *pkt = createSelfAdvert();
|
||||||
if (pkt) {
|
if (pkt) {
|
||||||
sendFlood(pkt, delay_millis);
|
if (flood) {
|
||||||
|
sendFlood(pkt, delay_millis);
|
||||||
|
} else {
|
||||||
|
sendZeroHop(pkt, delay_millis);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
MESH_DEBUG_PRINTLN("ERROR: unable to create advertisement packet!");
|
MESH_DEBUG_PRINTLN("ERROR: unable to create advertisement packet!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,12 +88,14 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
|
|||||||
NodePrefs _prefs;
|
NodePrefs _prefs;
|
||||||
CommonCLI _cli;
|
CommonCLI _cli;
|
||||||
uint8_t reply_data[MAX_PACKET_PAYLOAD];
|
uint8_t reply_data[MAX_PACKET_PAYLOAD];
|
||||||
|
uint8_t reply_path[MAX_PATH_SIZE];
|
||||||
|
int8_t reply_path_len;
|
||||||
ClientACL acl;
|
ClientACL acl;
|
||||||
TransportKeyStore key_store;
|
TransportKeyStore key_store;
|
||||||
RegionMap region_map, temp_map;
|
RegionMap region_map, temp_map;
|
||||||
RegionEntry* load_stack[8];
|
RegionEntry* load_stack[8];
|
||||||
RegionEntry* recv_pkt_region;
|
RegionEntry* recv_pkt_region;
|
||||||
RateLimiter discover_limiter;
|
RateLimiter discover_limiter, anon_limiter;
|
||||||
bool region_load_active;
|
bool region_load_active;
|
||||||
unsigned long dirty_contacts_expiry;
|
unsigned long dirty_contacts_expiry;
|
||||||
#if MAX_NEIGHBOURS
|
#if MAX_NEIGHBOURS
|
||||||
@@ -114,6 +116,9 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
|
|||||||
|
|
||||||
void putNeighbour(const mesh::Identity& id, uint32_t timestamp, float snr);
|
void putNeighbour(const mesh::Identity& id, uint32_t timestamp, float snr);
|
||||||
uint8_t handleLoginReq(const mesh::Identity& sender, const uint8_t* secret, uint32_t sender_timestamp, const uint8_t* data, bool is_flood);
|
uint8_t handleLoginReq(const mesh::Identity& sender, const uint8_t* secret, uint32_t sender_timestamp, const uint8_t* data, bool is_flood);
|
||||||
|
uint8_t handleAnonRegionsReq(const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t* data);
|
||||||
|
uint8_t handleAnonOwnerReq(const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t* data);
|
||||||
|
uint8_t handleAnonClockReq(const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t* data);
|
||||||
int handleRequest(ClientInfo* sender, uint32_t sender_timestamp, uint8_t* payload, size_t payload_len);
|
int handleRequest(ClientInfo* sender, uint32_t sender_timestamp, uint8_t* payload, size_t payload_len);
|
||||||
mesh::Packet* createSelfAdvert();
|
mesh::Packet* createSelfAdvert();
|
||||||
|
|
||||||
@@ -181,7 +186,7 @@ public:
|
|||||||
|
|
||||||
void applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins) override;
|
void applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins) override;
|
||||||
bool formatFileSystem() override;
|
bool formatFileSystem() override;
|
||||||
void sendSelfAdvertisement(int delay_millis) override;
|
void sendSelfAdvertisement(int delay_millis, bool flood = true) override;
|
||||||
void updateAdvertTimer() override;
|
void updateAdvertTimer() override;
|
||||||
void updateFloodAdvertTimer() override;
|
void updateFloodAdvertTimer() override;
|
||||||
|
|
||||||
|
|||||||
@@ -87,8 +87,10 @@ void setup() {
|
|||||||
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
|
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// send out initial Advertisement to the mesh
|
#if !defined(STEALTH_MODE) && !defined(NO_BOOT_ADVERT)
|
||||||
the_mesh.sendSelfAdvertisement(16000);
|
// send out initial Zero Hop Advertisement to the mesh
|
||||||
|
the_mesh.sendSelfAdvertisement(16000, false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|||||||
@@ -275,6 +275,15 @@ uint32_t MyMesh::getDirectRetransmitDelay(const mesh::Packet *packet) {
|
|||||||
bool MyMesh::allowPacketForward(const mesh::Packet *packet) {
|
bool MyMesh::allowPacketForward(const mesh::Packet *packet) {
|
||||||
if (_prefs.disable_fwd) return false;
|
if (_prefs.disable_fwd) return false;
|
||||||
if (packet->isRouteFlood() && packet->path_len >= _prefs.flood_max) return false;
|
if (packet->isRouteFlood() && packet->path_len >= _prefs.flood_max) return false;
|
||||||
|
|
||||||
|
// Limit flood advert paket forwarding using a probabilistic reduction defined by P(h) = 0.308^(hops-1)
|
||||||
|
// https://github.com/meshcore-dev/MeshCore/issues/1223
|
||||||
|
double_t roll_dice = (double)rand() / RAND_MAX;
|
||||||
|
double_t forw_prob = pow(_prefs.flood_advert_base, packet->path_len - 1);
|
||||||
|
if (packet->getPayloadType() == PAYLOAD_TYPE_ADVERT && packet->isRouteFlood() && roll_dice > forw_prob)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// all other packets
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,8 +620,9 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
|
|||||||
_prefs.cr = LORA_CR;
|
_prefs.cr = LORA_CR;
|
||||||
_prefs.tx_power_dbm = LORA_TX_POWER;
|
_prefs.tx_power_dbm = LORA_TX_POWER;
|
||||||
_prefs.disable_fwd = 1;
|
_prefs.disable_fwd = 1;
|
||||||
_prefs.advert_interval = 1; // default to 2 minutes for NEW installs
|
_prefs.advert_interval = DEF_LOCAL_ADVERT_INTERVAL;
|
||||||
_prefs.flood_advert_interval = 12; // 12 hours
|
_prefs.flood_advert_interval = DEF_FLOOD_ADVERT_INTERVAL;
|
||||||
|
_prefs.flood_advert_base = 0.308f;
|
||||||
_prefs.flood_max = 64;
|
_prefs.flood_max = 64;
|
||||||
_prefs.interference_threshold = 0; // disabled
|
_prefs.interference_threshold = 0; // disabled
|
||||||
#ifdef ROOM_PASSWORD
|
#ifdef ROOM_PASSWORD
|
||||||
@@ -675,10 +685,14 @@ bool MyMesh::formatFileSystem() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyMesh::sendSelfAdvertisement(int delay_millis) {
|
void MyMesh::sendSelfAdvertisement(int delay_millis, bool flood) {
|
||||||
mesh::Packet *pkt = createSelfAdvert();
|
mesh::Packet *pkt = createSelfAdvert();
|
||||||
if (pkt) {
|
if (pkt) {
|
||||||
sendFlood(pkt, delay_millis);
|
if (flood) {
|
||||||
|
sendFlood(pkt, delay_millis);
|
||||||
|
} else {
|
||||||
|
sendZeroHop(pkt, delay_millis);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
MESH_DEBUG_PRINTLN("ERROR: unable to create advertisement packet!");
|
MESH_DEBUG_PRINTLN("ERROR: unable to create advertisement packet!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ public:
|
|||||||
|
|
||||||
void applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins) override;
|
void applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t cr, int timeout_mins) override;
|
||||||
bool formatFileSystem() override;
|
bool formatFileSystem() override;
|
||||||
void sendSelfAdvertisement(int delay_millis) override;
|
void sendSelfAdvertisement(int delay_millis, bool flood = true) override;
|
||||||
void updateAdvertTimer() override;
|
void updateAdvertTimer() override;
|
||||||
void updateFloodAdvertTimer() override;
|
void updateFloodAdvertTimer() override;
|
||||||
|
|
||||||
|
|||||||
@@ -76,8 +76,10 @@ void setup() {
|
|||||||
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
|
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// send out initial Advertisement to the mesh
|
#if !defined(STEALTH_MODE) && !defined(NO_BOOT_ADVERT)
|
||||||
the_mesh.sendSelfAdvertisement(16000);
|
// send out initial Zero Hop Advertisement to the mesh
|
||||||
|
the_mesh.sendSelfAdvertisement(16000, false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|||||||
@@ -718,7 +718,7 @@ SensorMesh::SensorMesh(mesh::MainBoard& board, mesh::Radio& radio, mesh::Millise
|
|||||||
_prefs.bw = LORA_BW;
|
_prefs.bw = LORA_BW;
|
||||||
_prefs.cr = LORA_CR;
|
_prefs.cr = LORA_CR;
|
||||||
_prefs.tx_power_dbm = LORA_TX_POWER;
|
_prefs.tx_power_dbm = LORA_TX_POWER;
|
||||||
_prefs.advert_interval = 1; // default to 2 minutes for NEW installs
|
_prefs.advert_interval = DEF_LOCAL_ADVERT_INTERVAL;
|
||||||
_prefs.flood_advert_interval = 0; // disabled
|
_prefs.flood_advert_interval = 0; // disabled
|
||||||
_prefs.disable_fwd = true;
|
_prefs.disable_fwd = true;
|
||||||
_prefs.flood_max = 64;
|
_prefs.flood_max = 64;
|
||||||
@@ -788,10 +788,14 @@ void SensorMesh::applyTempRadioParams(float freq, float bw, uint8_t sf, uint8_t
|
|||||||
revert_radio_at = futureMillis(2000 + timeout_mins*60*1000); // schedule when to revert radio params
|
revert_radio_at = futureMillis(2000 + timeout_mins*60*1000); // schedule when to revert radio params
|
||||||
}
|
}
|
||||||
|
|
||||||
void SensorMesh::sendSelfAdvertisement(int delay_millis) {
|
void SensorMesh::sendSelfAdvertisement(int delay_millis, bool flood) {
|
||||||
mesh::Packet* pkt = createSelfAdvert();
|
mesh::Packet* pkt = createSelfAdvert();
|
||||||
if (pkt) {
|
if (pkt) {
|
||||||
sendFlood(pkt, delay_millis);
|
if (flood) {
|
||||||
|
sendFlood(pkt, delay_millis);
|
||||||
|
} else {
|
||||||
|
sendZeroHop(pkt, delay_millis);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
MESH_DEBUG_PRINTLN("ERROR: unable to create advertisement packet!");
|
MESH_DEBUG_PRINTLN("ERROR: unable to create advertisement packet!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public:
|
|||||||
NodePrefs* getNodePrefs() { return &_prefs; }
|
NodePrefs* getNodePrefs() { return &_prefs; }
|
||||||
void savePrefs() override { _cli.savePrefs(_fs); }
|
void savePrefs() override { _cli.savePrefs(_fs); }
|
||||||
bool formatFileSystem() override;
|
bool formatFileSystem() override;
|
||||||
void sendSelfAdvertisement(int delay_millis) override;
|
void sendSelfAdvertisement(int delay_millis, bool flood = true) override;
|
||||||
void updateAdvertTimer() override;
|
void updateAdvertTimer() override;
|
||||||
void updateFloodAdvertTimer() override;
|
void updateFloodAdvertTimer() override;
|
||||||
void setLoggingOn(bool enable) override { }
|
void setLoggingOn(bool enable) override { }
|
||||||
|
|||||||
@@ -110,8 +110,10 @@ void setup() {
|
|||||||
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
|
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// send out initial Advertisement to the mesh
|
#if !defined(STEALTH_MODE) && !defined(NO_BOOT_ADVERT)
|
||||||
the_mesh.sendSelfAdvertisement(16000);
|
// send out initial Zero Hop Advertisement to the mesh
|
||||||
|
the_mesh.sendSelfAdvertisement(16000, false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|||||||
@@ -23,12 +23,16 @@ lib_deps =
|
|||||||
adafruit/RTClib @ ^2.1.3
|
adafruit/RTClib @ ^2.1.3
|
||||||
melopero/Melopero RV3028 @ ^1.1.0
|
melopero/Melopero RV3028 @ ^1.1.0
|
||||||
electroniccats/CayenneLPP @ 1.6.1
|
electroniccats/CayenneLPP @ 1.6.1
|
||||||
build_flags = -w -DNDEBUG -DRADIOLIB_STATIC_ONLY=1 -DRADIOLIB_GODMODE=1
|
build_flags = -w -DNDEBUG
|
||||||
-D LORA_FREQ=869.525
|
-D LORA_FREQ=869.525
|
||||||
-D LORA_BW=250
|
-D LORA_BW=250
|
||||||
-D LORA_SF=11
|
-D LORA_SF=11
|
||||||
|
;
|
||||||
-D ENABLE_PRIVATE_KEY_IMPORT=1 ; NOTE: comment these out for more secure firmware
|
-D ENABLE_PRIVATE_KEY_IMPORT=1 ; NOTE: comment these out for more secure firmware
|
||||||
-D ENABLE_PRIVATE_KEY_EXPORT=1
|
-D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||||
|
;
|
||||||
|
-D RADIOLIB_STATIC_ONLY=1
|
||||||
|
-D RADIOLIB_GODMODE=1
|
||||||
-D RADIOLIB_EXCLUDE_CC1101=1
|
-D RADIOLIB_EXCLUDE_CC1101=1
|
||||||
-D RADIOLIB_EXCLUDE_RF69=1
|
-D RADIOLIB_EXCLUDE_RF69=1
|
||||||
-D RADIOLIB_EXCLUDE_SX1231=1
|
-D RADIOLIB_EXCLUDE_SX1231=1
|
||||||
@@ -43,6 +47,15 @@ build_flags = -w -DNDEBUG -DRADIOLIB_STATIC_ONLY=1 -DRADIOLIB_GODMODE=1
|
|||||||
-D RADIOLIB_EXCLUDE_BELL=1
|
-D RADIOLIB_EXCLUDE_BELL=1
|
||||||
-D RADIOLIB_EXCLUDE_RTTY=1
|
-D RADIOLIB_EXCLUDE_RTTY=1
|
||||||
-D RADIOLIB_EXCLUDE_SSTV=1
|
-D RADIOLIB_EXCLUDE_SSTV=1
|
||||||
|
;
|
||||||
|
-D MIN_LOCAL_ADVERT_INTERVAL=60
|
||||||
|
-D MAX_LOCAL_ADVERT_INTERVAL=240
|
||||||
|
-D DEF_LOCAL_ADVERT_INTERVAL=1 ; default to 2 minutes for NEW installs
|
||||||
|
-D MIN_FLOOD_ADVERT_INTERVAL=3
|
||||||
|
-D MAX_FLOOD_ADVERT_INTERVAL=48
|
||||||
|
-D DEF_FLOOD_ADVERT_INTERVAL=12 ; default to 12 hours for NEW installs
|
||||||
|
; -D NO_BOOT_ADVERT=1 ; disable boot advertisement
|
||||||
|
; -D STEALTH_MODE=1 ; disable all advertisements and DISCOVER_REQ
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
+<*.cpp>
|
+<*.cpp>
|
||||||
+<helpers/*.cpp>
|
+<helpers/*.cpp>
|
||||||
|
|||||||
@@ -477,6 +477,31 @@ int BaseChatMesh::sendLogin(const ContactInfo& recipient, const char* password,
|
|||||||
return MSG_SEND_FAILED;
|
return MSG_SEND_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int BaseChatMesh::sendAnonReq(const ContactInfo& recipient, const uint8_t* data, uint8_t len, uint32_t& tag, uint32_t& est_timeout) {
|
||||||
|
mesh::Packet* pkt;
|
||||||
|
{
|
||||||
|
uint8_t temp[MAX_PACKET_PAYLOAD];
|
||||||
|
tag = getRTCClock()->getCurrentTimeUnique();
|
||||||
|
memcpy(temp, &tag, 4); // tag to match later (also extra blob to help make packet_hash unique)
|
||||||
|
memcpy(&temp[4], data, len);
|
||||||
|
|
||||||
|
pkt = createAnonDatagram(PAYLOAD_TYPE_ANON_REQ, self_id, recipient.id, recipient.getSharedSecret(self_id), temp, 4 + len);
|
||||||
|
}
|
||||||
|
if (pkt) {
|
||||||
|
uint32_t t = _radio->getEstAirtimeFor(pkt->getRawLength());
|
||||||
|
if (recipient.out_path_len < 0) {
|
||||||
|
sendFloodScoped(recipient, pkt);
|
||||||
|
est_timeout = calcFloodTimeoutMillisFor(t);
|
||||||
|
return MSG_SEND_SENT_FLOOD;
|
||||||
|
} else {
|
||||||
|
sendDirect(pkt, recipient.out_path, recipient.out_path_len);
|
||||||
|
est_timeout = calcDirectTimeoutMillisFor(t, recipient.out_path_len);
|
||||||
|
return MSG_SEND_SENT_DIRECT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MSG_SEND_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
int BaseChatMesh::sendRequest(const ContactInfo& recipient, const uint8_t* req_data, uint8_t data_len, uint32_t& tag, uint32_t& est_timeout) {
|
int BaseChatMesh::sendRequest(const ContactInfo& recipient, const uint8_t* req_data, uint8_t data_len, uint32_t& tag, uint32_t& est_timeout) {
|
||||||
if (data_len > MAX_PACKET_PAYLOAD - 16) return MSG_SEND_FAILED;
|
if (data_len > MAX_PACKET_PAYLOAD - 16) return MSG_SEND_FAILED;
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ public:
|
|||||||
int sendCommandData(const ContactInfo& recipient, uint32_t timestamp, uint8_t attempt, const char* text, uint32_t& est_timeout);
|
int sendCommandData(const ContactInfo& recipient, uint32_t timestamp, uint8_t attempt, const char* text, uint32_t& est_timeout);
|
||||||
bool sendGroupMessage(uint32_t timestamp, mesh::GroupChannel& channel, const char* sender_name, const char* text, int text_len);
|
bool sendGroupMessage(uint32_t timestamp, mesh::GroupChannel& channel, const char* sender_name, const char* text, int text_len);
|
||||||
int sendLogin(const ContactInfo& recipient, const char* password, uint32_t& est_timeout);
|
int sendLogin(const ContactInfo& recipient, const char* password, uint32_t& est_timeout);
|
||||||
|
int sendAnonReq(const ContactInfo& recipient, const uint8_t* data, uint8_t len, uint32_t& tag, uint32_t& est_timeout);
|
||||||
int sendRequest(const ContactInfo& recipient, uint8_t req_type, uint32_t& tag, uint32_t& est_timeout);
|
int sendRequest(const ContactInfo& recipient, uint8_t req_type, uint32_t& tag, uint32_t& est_timeout);
|
||||||
int sendRequest(const ContactInfo& recipient, const uint8_t* req_data, uint8_t data_len, uint32_t& tag, uint32_t& est_timeout);
|
int sendRequest(const ContactInfo& recipient, const uint8_t* req_data, uint8_t data_len, uint32_t& tag, uint32_t& est_timeout);
|
||||||
bool shareContactZeroHop(const ContactInfo& contact);
|
bool shareContactZeroHop(const ContactInfo& contact);
|
||||||
|
|||||||
@@ -14,6 +14,14 @@ static uint32_t _atoi(const char* sp) {
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isValidName(const char *n) {
|
||||||
|
while (*n) {
|
||||||
|
if (*n == '[' || *n == ']' || *n == '/' || *n == '\\' || *n == ':' || *n == ',' || *n == '?' || *n == '*') return false;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void CommonCLI::loadPrefs(FILESYSTEM* fs) {
|
void CommonCLI::loadPrefs(FILESYSTEM* fs) {
|
||||||
if (fs->exists("/com_prefs")) {
|
if (fs->exists("/com_prefs")) {
|
||||||
loadPrefsInt(fs, "/com_prefs"); // new filename
|
loadPrefsInt(fs, "/com_prefs"); // new filename
|
||||||
@@ -72,7 +80,10 @@ void CommonCLI::loadPrefsInt(FILESYSTEM* fs, const char* filename) {
|
|||||||
file.read((uint8_t *)&_prefs->advert_loc_policy, sizeof (_prefs->advert_loc_policy)); // 161
|
file.read((uint8_t *)&_prefs->advert_loc_policy, sizeof (_prefs->advert_loc_policy)); // 161
|
||||||
file.read((uint8_t *)&_prefs->discovery_mod_timestamp, sizeof(_prefs->discovery_mod_timestamp)); // 162
|
file.read((uint8_t *)&_prefs->discovery_mod_timestamp, sizeof(_prefs->discovery_mod_timestamp)); // 162
|
||||||
file.read((uint8_t *)&_prefs->adc_multiplier, sizeof(_prefs->adc_multiplier)); // 166
|
file.read((uint8_t *)&_prefs->adc_multiplier, sizeof(_prefs->adc_multiplier)); // 166
|
||||||
// 170
|
file.read((uint8_t *)_prefs->owner_info, sizeof(_prefs->owner_info)); // 170
|
||||||
|
file.read((uint8_t *)&_prefs->flood_advert_base, sizeof(_prefs->flood_advert_base)); // 290
|
||||||
|
|
||||||
|
// 294
|
||||||
|
|
||||||
// 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);
|
||||||
@@ -99,6 +110,8 @@ void CommonCLI::loadPrefsInt(FILESYSTEM* fs, const char* filename) {
|
|||||||
_prefs->gps_enabled = constrain(_prefs->gps_enabled, 0, 1);
|
_prefs->gps_enabled = constrain(_prefs->gps_enabled, 0, 1);
|
||||||
_prefs->advert_loc_policy = constrain(_prefs->advert_loc_policy, 0, 2);
|
_prefs->advert_loc_policy = constrain(_prefs->advert_loc_policy, 0, 2);
|
||||||
|
|
||||||
|
_prefs->flood_advert_base = constrain(_prefs->flood_advert_base, 0, 1);
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,14 +168,15 @@ void CommonCLI::savePrefs(FILESYSTEM* fs) {
|
|||||||
file.write((uint8_t *)&_prefs->advert_loc_policy, sizeof(_prefs->advert_loc_policy)); // 161
|
file.write((uint8_t *)&_prefs->advert_loc_policy, sizeof(_prefs->advert_loc_policy)); // 161
|
||||||
file.write((uint8_t *)&_prefs->discovery_mod_timestamp, sizeof(_prefs->discovery_mod_timestamp)); // 162
|
file.write((uint8_t *)&_prefs->discovery_mod_timestamp, sizeof(_prefs->discovery_mod_timestamp)); // 162
|
||||||
file.write((uint8_t *)&_prefs->adc_multiplier, sizeof(_prefs->adc_multiplier)); // 166
|
file.write((uint8_t *)&_prefs->adc_multiplier, sizeof(_prefs->adc_multiplier)); // 166
|
||||||
// 170
|
file.write((uint8_t *)_prefs->owner_info, sizeof(_prefs->owner_info)); // 170
|
||||||
|
file.write((uint8_t *)&_prefs->flood_advert_base, sizeof(_prefs->flood_advert_base)); // 290
|
||||||
|
|
||||||
|
// 294
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MIN_LOCAL_ADVERT_INTERVAL 60
|
|
||||||
|
|
||||||
void CommonCLI::savePrefs() {
|
void CommonCLI::savePrefs() {
|
||||||
if (_prefs->advert_interval * 2 < MIN_LOCAL_ADVERT_INTERVAL) {
|
if (_prefs->advert_interval * 2 < MIN_LOCAL_ADVERT_INTERVAL) {
|
||||||
_prefs->advert_interval = 0; // turn it off, now that device has been manually configured
|
_prefs->advert_interval = 0; // turn it off, now that device has been manually configured
|
||||||
@@ -187,6 +201,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
|||||||
if (memcmp(command, "reboot", 6) == 0) {
|
if (memcmp(command, "reboot", 6) == 0) {
|
||||||
_board->reboot(); // doesn't return
|
_board->reboot(); // doesn't return
|
||||||
} else if (memcmp(command, "advert", 6) == 0) {
|
} else if (memcmp(command, "advert", 6) == 0) {
|
||||||
|
// Keep "advert" as flood for backward compatibility
|
||||||
_callbacks->sendSelfAdvertisement(1500); // longer delay, give CLI response time to be sent first
|
_callbacks->sendSelfAdvertisement(1500); // longer delay, give CLI response time to be sent first
|
||||||
strcpy(reply, "OK - Advert sent");
|
strcpy(reply, "OK - Advert sent");
|
||||||
} else if (memcmp(command, "clock sync", 10) == 0) {
|
} else if (memcmp(command, "clock sync", 10) == 0) {
|
||||||
@@ -207,7 +222,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
|||||||
uint32_t now = getRTCClock()->getCurrentTime();
|
uint32_t now = getRTCClock()->getCurrentTime();
|
||||||
DateTime dt = DateTime(now);
|
DateTime dt = DateTime(now);
|
||||||
sprintf(reply, "%02d:%02d - %d/%d/%d UTC", dt.hour(), dt.minute(), dt.day(), dt.month(), dt.year());
|
sprintf(reply, "%02d:%02d - %d/%d/%d UTC", dt.hour(), dt.minute(), dt.day(), dt.month(), dt.year());
|
||||||
} else if (memcmp(command, "time ", 5) == 0) { // set time (to epoch seconds)
|
} else if (memcmp(command, "time ", 5) == 0) { // set time (to epoch seconds)
|
||||||
uint32_t secs = _atoi(&command[5]);
|
uint32_t secs = _atoi(&command[5]);
|
||||||
uint32_t curr = getRTCClock()->getCurrentTime();
|
uint32_t curr = getRTCClock()->getCurrentTime();
|
||||||
if (secs > curr) {
|
if (secs > curr) {
|
||||||
@@ -301,6 +316,15 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
|||||||
sprintf(reply, "> %d", (uint32_t)_prefs->flood_max);
|
sprintf(reply, "> %d", (uint32_t)_prefs->flood_max);
|
||||||
} else if (memcmp(config, "direct.txdelay", 14) == 0) {
|
} else if (memcmp(config, "direct.txdelay", 14) == 0) {
|
||||||
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->direct_tx_delay_factor));
|
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->direct_tx_delay_factor));
|
||||||
|
} else if (memcmp(config, "owner.info", 10) == 0) {
|
||||||
|
*reply++ = '>';
|
||||||
|
*reply++ = ' ';
|
||||||
|
const char* sp = _prefs->owner_info;
|
||||||
|
while (*sp) {
|
||||||
|
*reply++ = (*sp == '\n') ? '|' : *sp; // translate newline back to orig '|'
|
||||||
|
sp++;
|
||||||
|
}
|
||||||
|
*reply = 0; // set null terminator
|
||||||
} else if (memcmp(config, "tx", 2) == 0 && (config[2] == 0 || config[2] == ' ')) {
|
} else if (memcmp(config, "tx", 2) == 0 && (config[2] == 0 || config[2] == ' ')) {
|
||||||
sprintf(reply, "> %d", (uint32_t) _prefs->tx_power_dbm);
|
sprintf(reply, "> %d", (uint32_t) _prefs->tx_power_dbm);
|
||||||
} else if (memcmp(config, "freq", 4) == 0) {
|
} else if (memcmp(config, "freq", 4) == 0) {
|
||||||
@@ -345,6 +369,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
|||||||
} else {
|
} else {
|
||||||
sprintf(reply, "> %.3f", adc_mult);
|
sprintf(reply, "> %.3f", adc_mult);
|
||||||
}
|
}
|
||||||
|
} else if (memcmp(config, "flood.advert.base", 17) == 0) {
|
||||||
|
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->flood_advert_base));
|
||||||
} else {
|
} else {
|
||||||
sprintf(reply, "??: %s", config);
|
sprintf(reply, "??: %s", config);
|
||||||
}
|
}
|
||||||
@@ -375,8 +401,9 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
|||||||
strcpy(reply, "OK");
|
strcpy(reply, "OK");
|
||||||
} else if (memcmp(config, "flood.advert.interval ", 22) == 0) {
|
} else if (memcmp(config, "flood.advert.interval ", 22) == 0) {
|
||||||
int hours = _atoi(&config[22]);
|
int hours = _atoi(&config[22]);
|
||||||
if ((hours > 0 && hours < 3) || (hours > 48)) {
|
if ((hours > 0 && hours < MIN_FLOOD_ADVERT_INTERVAL) || (hours > MAX_FLOOD_ADVERT_INTERVAL)) {
|
||||||
strcpy(reply, "Error: interval range is 3-48 hours");
|
sprintf(reply, "Error: interval range is %d-%d hours", MIN_FLOOD_ADVERT_INTERVAL,
|
||||||
|
MAX_FLOOD_ADVERT_INTERVAL);
|
||||||
} else {
|
} else {
|
||||||
_prefs->flood_advert_interval = (uint8_t)(hours);
|
_prefs->flood_advert_interval = (uint8_t)(hours);
|
||||||
_callbacks->updateFloodAdvertTimer();
|
_callbacks->updateFloodAdvertTimer();
|
||||||
@@ -385,8 +412,9 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
|||||||
}
|
}
|
||||||
} else if (memcmp(config, "advert.interval ", 16) == 0) {
|
} else if (memcmp(config, "advert.interval ", 16) == 0) {
|
||||||
int mins = _atoi(&config[16]);
|
int mins = _atoi(&config[16]);
|
||||||
if ((mins > 0 && mins < MIN_LOCAL_ADVERT_INTERVAL) || (mins > 240)) {
|
if ((mins > 0 && mins < MIN_LOCAL_ADVERT_INTERVAL) || (mins > MAX_LOCAL_ADVERT_INTERVAL)) {
|
||||||
sprintf(reply, "Error: interval range is %d-240 minutes", MIN_LOCAL_ADVERT_INTERVAL);
|
sprintf(reply, "Error: interval range is %d-%d minutes",MIN_LOCAL_ADVERT_INTERVAL,
|
||||||
|
MAX_LOCAL_ADVERT_INTERVAL);
|
||||||
} else {
|
} else {
|
||||||
_prefs->advert_interval = (uint8_t)(mins / 2);
|
_prefs->advert_interval = (uint8_t)(mins / 2);
|
||||||
_callbacks->updateAdvertTimer();
|
_callbacks->updateAdvertTimer();
|
||||||
@@ -410,9 +438,13 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
|||||||
strcpy(reply, "Error, invalid key");
|
strcpy(reply, "Error, invalid key");
|
||||||
}
|
}
|
||||||
} else if (memcmp(config, "name ", 5) == 0) {
|
} else if (memcmp(config, "name ", 5) == 0) {
|
||||||
StrHelper::strncpy(_prefs->node_name, &config[5], sizeof(_prefs->node_name));
|
if (isValidName(&config[5])) {
|
||||||
savePrefs();
|
StrHelper::strncpy(_prefs->node_name, &config[5], sizeof(_prefs->node_name));
|
||||||
strcpy(reply, "OK");
|
savePrefs();
|
||||||
|
strcpy(reply, "OK");
|
||||||
|
} else {
|
||||||
|
strcpy(reply, "Error, bad chars");
|
||||||
|
}
|
||||||
} else if (memcmp(config, "repeat ", 7) == 0) {
|
} else if (memcmp(config, "repeat ", 7) == 0) {
|
||||||
_prefs->disable_fwd = memcmp(&config[7], "off", 3) == 0;
|
_prefs->disable_fwd = memcmp(&config[7], "off", 3) == 0;
|
||||||
savePrefs();
|
savePrefs();
|
||||||
@@ -479,6 +511,16 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
|||||||
} else {
|
} else {
|
||||||
strcpy(reply, "Error, cannot be negative");
|
strcpy(reply, "Error, cannot be negative");
|
||||||
}
|
}
|
||||||
|
} else if (memcmp(config, "owner.info ", 11) == 0) {
|
||||||
|
config += 11;
|
||||||
|
char *dp = _prefs->owner_info;
|
||||||
|
while (*config && dp - _prefs->owner_info < sizeof(_prefs->owner_info)-1) {
|
||||||
|
*dp++ = (*config == '|') ? '\n' : *config; // translate '|' to newline chars
|
||||||
|
config++;
|
||||||
|
}
|
||||||
|
*dp = 0;
|
||||||
|
savePrefs();
|
||||||
|
strcpy(reply, "OK");
|
||||||
} else if (memcmp(config, "tx ", 3) == 0) {
|
} else if (memcmp(config, "tx ", 3) == 0) {
|
||||||
_prefs->tx_power_dbm = atoi(&config[3]);
|
_prefs->tx_power_dbm = atoi(&config[3]);
|
||||||
savePrefs();
|
savePrefs();
|
||||||
@@ -550,6 +592,15 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
|
|||||||
_prefs->adc_multiplier = 0.0f;
|
_prefs->adc_multiplier = 0.0f;
|
||||||
strcpy(reply, "Error: unsupported by this board");
|
strcpy(reply, "Error: unsupported by this board");
|
||||||
};
|
};
|
||||||
|
} else if (memcmp(config, "flood.advert.base ", 18) == 0) {
|
||||||
|
float f = atof(&config[18]);
|
||||||
|
if((f > 0) || (f<1)) {
|
||||||
|
_prefs->flood_advert_base = f;
|
||||||
|
savePrefs();
|
||||||
|
strcpy(reply, "OK");
|
||||||
|
} else {
|
||||||
|
strcpy(reply, "Error: base must be between 0 and 1");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sprintf(reply, "unknown config: %s", config);
|
sprintf(reply, "unknown config: %s", config);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ struct NodePrefs { // persisted to file
|
|||||||
uint8_t flood_max;
|
uint8_t flood_max;
|
||||||
uint8_t interference_threshold;
|
uint8_t interference_threshold;
|
||||||
uint8_t agc_reset_interval; // secs / 4
|
uint8_t agc_reset_interval; // secs / 4
|
||||||
|
float flood_advert_base;
|
||||||
// Bridge settings
|
// Bridge settings
|
||||||
uint8_t bridge_enabled; // boolean
|
uint8_t bridge_enabled; // boolean
|
||||||
uint16_t bridge_delay; // milliseconds (default 500 ms)
|
uint16_t bridge_delay; // milliseconds (default 500 ms)
|
||||||
@@ -50,6 +51,7 @@ struct NodePrefs { // persisted to file
|
|||||||
uint8_t advert_loc_policy;
|
uint8_t advert_loc_policy;
|
||||||
uint32_t discovery_mod_timestamp;
|
uint32_t discovery_mod_timestamp;
|
||||||
float adc_multiplier;
|
float adc_multiplier;
|
||||||
|
char owner_info[120];
|
||||||
};
|
};
|
||||||
|
|
||||||
class CommonCLICallbacks {
|
class CommonCLICallbacks {
|
||||||
@@ -59,7 +61,7 @@ public:
|
|||||||
virtual const char* getBuildDate() = 0;
|
virtual const char* getBuildDate() = 0;
|
||||||
virtual const char* getRole() = 0;
|
virtual const char* getRole() = 0;
|
||||||
virtual bool formatFileSystem() = 0;
|
virtual bool formatFileSystem() = 0;
|
||||||
virtual void sendSelfAdvertisement(int delay_millis) = 0;
|
virtual void sendSelfAdvertisement(int delay_millis, bool flood = true) = 0;
|
||||||
virtual void updateAdvertTimer() = 0;
|
virtual void updateAdvertTimer() = 0;
|
||||||
virtual void updateFloodAdvertTimer() = 0;
|
virtual void updateFloodAdvertTimer() = 0;
|
||||||
virtual void setLoggingOn(bool enable) = 0;
|
virtual void setLoggingOn(bool enable) = 0;
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ RegionMap::RegionMap(TransportKeyStore& store) : _store(&store) {
|
|||||||
strcpy(wildcard.name, "*");
|
strcpy(wildcard.name, "*");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RegionMap::is_name_char(char c) {
|
bool RegionMap::is_name_char(uint8_t c) {
|
||||||
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '-' || c == '.' || c == '_' || c == '#';
|
// accept all alpha-num or accented characters, but exclude most punctuation chars
|
||||||
|
return c == '-' || c == '#' || (c >= '0' && c <= '9') || c >= 'A';
|
||||||
}
|
}
|
||||||
|
|
||||||
static File openWrite(FILESYSTEM* _fs, const char* filename) {
|
static File openWrite(FILESYSTEM* _fs, const char* filename) {
|
||||||
@@ -24,12 +25,12 @@ static File openWrite(FILESYSTEM* _fs, const char* filename) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RegionMap::load(FILESYSTEM* _fs) {
|
bool RegionMap::load(FILESYSTEM* _fs, const char* path) {
|
||||||
if (_fs->exists("/regions2")) {
|
if (_fs->exists(path ? path : "/regions2")) {
|
||||||
#if defined(RP2040_PLATFORM)
|
#if defined(RP2040_PLATFORM)
|
||||||
File file = _fs->open("/regions2", "r");
|
File file = _fs->open(path ? path : "/regions2", "r");
|
||||||
#else
|
#else
|
||||||
File file = _fs->open("/regions2");
|
File file = _fs->open(path ? path : "/regions2");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
@@ -67,8 +68,8 @@ bool RegionMap::load(FILESYSTEM* _fs) {
|
|||||||
return false; // failed
|
return false; // failed
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RegionMap::save(FILESYSTEM* _fs) {
|
bool RegionMap::save(FILESYSTEM* _fs, const char* path) {
|
||||||
File file = openWrite(_fs, "/regions2");
|
File file = openWrite(_fs, path ? path : "/regions2");
|
||||||
if (file) {
|
if (file) {
|
||||||
uint8_t pad[128];
|
uint8_t pad[128];
|
||||||
memset(pad, 0, sizeof(pad));
|
memset(pad, 0, sizeof(pad));
|
||||||
@@ -235,3 +236,27 @@ void RegionMap::printChildRegions(int indent, const RegionEntry* parent, Stream&
|
|||||||
void RegionMap::exportTo(Stream& out) const {
|
void RegionMap::exportTo(Stream& out) const {
|
||||||
printChildRegions(0, &wildcard, out); // recursive
|
printChildRegions(0, &wildcard, out); // recursive
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int RegionMap::exportNamesTo(char *dest, int max_len, uint8_t mask) {
|
||||||
|
char *dp = dest;
|
||||||
|
if ((wildcard.flags & mask) == 0) {
|
||||||
|
*dp++ = '*';
|
||||||
|
*dp++ = ',';
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < num_regions; i++) {
|
||||||
|
auto region = ®ions[i];
|
||||||
|
if ((region->flags & mask) == 0) { // region allowed? (per 'mask' param)
|
||||||
|
int len = strlen(region->name);
|
||||||
|
if ((dp - dest) + len + 2 < max_len) { // only append if name will fit
|
||||||
|
memcpy(dp, region->name, len);
|
||||||
|
dp += len;
|
||||||
|
*dp++ = ',';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dp > dest) { dp--; } // don't include trailing comma
|
||||||
|
|
||||||
|
*dp = 0; // set null terminator
|
||||||
|
return dp - dest; // return length
|
||||||
|
}
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ class RegionMap {
|
|||||||
public:
|
public:
|
||||||
RegionMap(TransportKeyStore& store);
|
RegionMap(TransportKeyStore& store);
|
||||||
|
|
||||||
static bool is_name_char(char c);
|
static bool is_name_char(uint8_t c);
|
||||||
|
|
||||||
bool load(FILESYSTEM* _fs);
|
bool load(FILESYSTEM* _fs, const char* path=NULL);
|
||||||
bool save(FILESYSTEM* _fs);
|
bool save(FILESYSTEM* _fs, const char* path=NULL);
|
||||||
|
|
||||||
RegionEntry* putRegion(const char* name, uint16_t parent_id, uint16_t id = 0);
|
RegionEntry* putRegion(const char* name, uint16_t parent_id, uint16_t id = 0);
|
||||||
RegionEntry* findMatch(mesh::Packet* packet, uint8_t mask);
|
RegionEntry* findMatch(mesh::Packet* packet, uint8_t mask);
|
||||||
@@ -47,6 +47,9 @@ public:
|
|||||||
bool clear();
|
bool clear();
|
||||||
void resetFrom(const RegionMap& src) { num_regions = 0; next_id = src.next_id; }
|
void resetFrom(const RegionMap& src) { num_regions = 0; next_id = src.next_id; }
|
||||||
int getCount() const { return num_regions; }
|
int getCount() const { return num_regions; }
|
||||||
|
const RegionEntry* getByIdx(int i) const { return ®ions[i]; }
|
||||||
|
const RegionEntry* getRoot() const { return &wildcard; }
|
||||||
|
int exportNamesTo(char *dest, int max_len, uint8_t mask);
|
||||||
|
|
||||||
void exportTo(Stream& out) const;
|
void exportTo(Stream& out) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
[ikoka_nrf52]
|
[ikoka_handheld_nrf]
|
||||||
extends = Xiao_nrf52
|
extends = nrf52_base
|
||||||
lib_deps = ${nrf52_base.lib_deps}
|
|
||||||
${sensor_base.lib_deps}
|
|
||||||
densaugeo/base64 @ ~1.4.0
|
|
||||||
build_flags = ${nrf52_base.build_flags}
|
build_flags = ${nrf52_base.build_flags}
|
||||||
${sensor_base.build_flags}
|
${sensor_base.build_flags}
|
||||||
-I lib/nrf52/s140_nrf52_7.3.0_API/include
|
-I lib/nrf52/s140_nrf52_7.3.0_API/include
|
||||||
@@ -26,12 +23,15 @@ build_flags = ${nrf52_base.build_flags}
|
|||||||
build_src_filter = ${nrf52_base.build_src_filter}
|
build_src_filter = ${nrf52_base.build_src_filter}
|
||||||
+<../variants/ikoka_handheld_nrf>
|
+<../variants/ikoka_handheld_nrf>
|
||||||
+<helpers/sensors>
|
+<helpers/sensors>
|
||||||
|
lib_deps = ${nrf52_base.lib_deps}
|
||||||
|
${sensor_base.lib_deps}
|
||||||
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
# larger screen has a different driver, this is for the 0.96 inch
|
# larger screen has a different driver, this is for the 0.96 inch
|
||||||
[ikoka_nrf52_ssd1306_companion]
|
[ikoka_handheld_nrf_ssd1306_companion]
|
||||||
lib_deps = ${ikoka_nrf52.lib_deps}
|
lib_deps = ${ikoka_handheld_nrf.lib_deps}
|
||||||
adafruit/Adafruit SSD1306 @ ^2.5.13
|
adafruit/Adafruit SSD1306 @ ^2.5.13
|
||||||
build_flags = ${ikoka_nrf52.build_flags}
|
build_flags = ${ikoka_handheld_nrf.build_flags}
|
||||||
-D DISPLAY_CLASS=SSD1306Display
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
-D DISPLAY_ROTATION=0
|
-D DISPLAY_ROTATION=0
|
||||||
-D PIN_WIRE_SCL=D6
|
-D PIN_WIRE_SCL=D6
|
||||||
@@ -42,62 +42,62 @@ build_flags = ${ikoka_nrf52.build_flags}
|
|||||||
-D OFFLINE_QUEUE_SIZE=256
|
-D OFFLINE_QUEUE_SIZE=256
|
||||||
-D QSPIFLASH=1
|
-D QSPIFLASH=1
|
||||||
-I examples/companion_radio/ui-new
|
-I examples/companion_radio/ui-new
|
||||||
build_src_filter = ${ikoka_nrf52.build_src_filter}
|
build_src_filter = ${ikoka_handheld_nrf.build_src_filter}
|
||||||
+<helpers/ui/SSD1306Display.cpp>
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
+<../examples/companion_radio/ui-new/UITask.cpp>
|
+<../examples/companion_radio/ui-new/UITask.cpp>
|
||||||
+<../examples/companion_radio/*.cpp>
|
+<../examples/companion_radio/*.cpp>
|
||||||
|
|
||||||
[env:ikoka_handheld_nrf_e22_30dbm_096_companion_radio_ble]
|
[env:ikoka_handheld_nrf_e22_30dbm_096_companion_radio_ble]
|
||||||
extends = ikoka_nrf52
|
extends = ikoka_nrf52
|
||||||
build_flags = ${ikoka_nrf52_ssd1306_companion.build_flags}
|
build_flags = ${ikoka_handheld_nrf_ssd1306_companion.build_flags}
|
||||||
-D BLE_PIN_CODE=123456
|
-D BLE_PIN_CODE=123456
|
||||||
-D LORA_TX_POWER=20
|
-D LORA_TX_POWER=20
|
||||||
build_src_filter = ${ikoka_nrf52_ssd1306_companion.build_src_filter}
|
build_src_filter = ${ikoka_handheld_nrf_ssd1306_companion.build_src_filter}
|
||||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||||
|
|
||||||
[env:ikoka_handheld_nrf_e22_30dbm_096_rotated_companion_radio_ble]
|
[env:ikoka_handheld_nrf_e22_30dbm_096_rotated_companion_radio_ble]
|
||||||
extends = ikoka_nrf52
|
extends = ikoka_nrf52
|
||||||
build_flags = ${ikoka_nrf52_ssd1306_companion.build_flags}
|
build_flags = ${ikoka_handheld_nrf_ssd1306_companion.build_flags}
|
||||||
-D BLE_PIN_CODE=123456
|
-D BLE_PIN_CODE=123456
|
||||||
-D LORA_TX_POWER=20
|
-D LORA_TX_POWER=20
|
||||||
-D DISPLAY_ROTATION=2
|
-D DISPLAY_ROTATION=2
|
||||||
build_src_filter = ${ikoka_nrf52_ssd1306_companion.build_src_filter}
|
build_src_filter = ${ikoka_handheld_nrf_ssd1306_companion.build_src_filter}
|
||||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||||
|
|
||||||
[env:ikoka_handheld_nrf_e22_30dbm_096_companion_radio_usb]
|
[env:ikoka_handheld_nrf_e22_30dbm_096_companion_radio_usb]
|
||||||
extends = ikoka_nrf52
|
extends = ikoka_nrf52
|
||||||
build_flags = ${ikoka_nrf52_ssd1306_companion.build_flags}
|
build_flags = ${ikoka_handheld_nrf_ssd1306_companion.build_flags}
|
||||||
-D LORA_TX_POWER=20
|
-D LORA_TX_POWER=20
|
||||||
build_src_filter = ${ikoka_nrf52_ssd1306_companion.build_src_filter}
|
build_src_filter = ${ikoka_handheld_nrf_ssd1306_companion.build_src_filter}
|
||||||
|
|
||||||
[env:ikoka_handheld_nrf_e22_30dbm_096_rotated_companion_radio_usb]
|
[env:ikoka_handheld_nrf_e22_30dbm_096_rotated_companion_radio_usb]
|
||||||
extends = ikoka_nrf52
|
extends = ikoka_nrf52
|
||||||
build_flags = ${ikoka_nrf52_ssd1306_companion.build_flags}
|
build_flags = ${ikoka_handheld_nrf_ssd1306_companion.build_flags}
|
||||||
-D LORA_TX_POWER=20
|
-D LORA_TX_POWER=20
|
||||||
-D DISPLAY_ROTATION=2
|
-D DISPLAY_ROTATION=2
|
||||||
build_src_filter = ${ikoka_nrf52_ssd1306_companion.build_src_filter}
|
build_src_filter = ${ikoka_handheld_nrf_ssd1306_companion.build_src_filter}
|
||||||
|
|
||||||
[env:ikoka_handheld_nrf_e22_30dbm_repeater]
|
[env:ikoka_handheld_nrf_e22_30dbm_repeater]
|
||||||
extends = ikoka_nrf52
|
extends = ikoka_nrf52
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_nrf52.build_flags}
|
${ikoka_handheld_nrf.build_flags}
|
||||||
-D ADVERT_NAME='"ikoka_handheld Repeater"'
|
-D ADVERT_NAME='"ikoka_handheld Repeater"'
|
||||||
-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 MAX_NEIGHBOURS=50
|
-D MAX_NEIGHBOURS=50
|
||||||
-D LORA_TX_POWER=20
|
-D LORA_TX_POWER=20
|
||||||
build_src_filter = ${ikoka_nrf52.build_src_filter}
|
build_src_filter = ${ikoka_handheld_nrf.build_src_filter}
|
||||||
+<../examples/simple_repeater/*.cpp>
|
+<../examples/simple_repeater/*.cpp>
|
||||||
|
|
||||||
[env:ikoka_handheld_nrf_e22_30dbm_room_server]
|
[env:ikoka_handheld_nrf_e22_30dbm_room_server]
|
||||||
extends = ikoka_nrf52
|
extends = ikoka_nrf52
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_nrf52.build_flags}
|
${ikoka_handheld_nrf.build_flags}
|
||||||
-D ADVERT_NAME='"ikoka_handheld Room"'
|
-D ADVERT_NAME='"ikoka_handheld Room"'
|
||||||
-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 LORA_TX_POWER=20
|
-D LORA_TX_POWER=20
|
||||||
build_src_filter = ${ikoka_nrf52.build_src_filter}
|
build_src_filter = ${ikoka_handheld_nrf.build_src_filter}
|
||||||
+<../examples/simple_room_server/*.cpp>
|
+<../examples/simple_room_server/*.cpp>
|
||||||
|
|||||||
@@ -1,151 +1,124 @@
|
|||||||
[nrf52840_xiao]
|
[ikoka_nano_nrf]
|
||||||
extends = nrf52_base
|
extends = nrf52_base
|
||||||
platform_packages =
|
|
||||||
toolchain-gccarmnoneeabi@~1.100301.0
|
|
||||||
framework-arduinoadafruitnrf52
|
|
||||||
board = seeed-xiao-afruitnrf52-nrf52840
|
board = seeed-xiao-afruitnrf52-nrf52840
|
||||||
board_build.ldscript = boards/nrf52840_s140_v7.ld
|
board_build.ldscript = boards/nrf52840_s140_v7.ld
|
||||||
build_flags = ${nrf52_base.build_flags}
|
build_flags = ${nrf52_base.build_flags}
|
||||||
|
${sensor_base.build_flags}
|
||||||
-D NRF52_PLATFORM -D XIAO_NRF52
|
-D NRF52_PLATFORM -D XIAO_NRF52
|
||||||
-I lib/nrf52/s140_nrf52_7.3.0_API/include
|
-I lib/nrf52/s140_nrf52_7.3.0_API/include
|
||||||
-I lib/nrf52/s140_nrf52_7.3.0_API/include/nrf52
|
-I lib/nrf52/s140_nrf52_7.3.0_API/include/nrf52
|
||||||
lib_ignore =
|
|
||||||
BluetoothOTA
|
|
||||||
lvgl
|
|
||||||
lib5b4
|
|
||||||
lib_deps =
|
|
||||||
${nrf52_base.lib_deps}
|
|
||||||
rweather/Crypto @ ^0.4.0
|
|
||||||
adafruit/Adafruit INA3221 Library @ ^1.0.1
|
|
||||||
adafruit/Adafruit INA219 @ ^1.2.3
|
|
||||||
adafruit/Adafruit AHTX0 @ ^2.0.5
|
|
||||||
adafruit/Adafruit BME280 Library @ ^2.3.0
|
|
||||||
adafruit/Adafruit SSD1306 @ ^2.5.13
|
|
||||||
|
|
||||||
[ikoka_nano_nrf_baseboard]
|
|
||||||
extends = nrf52840_xiao
|
|
||||||
;board_build.ldscript = boards/nrf52840_s140_v7.ld
|
|
||||||
build_flags = ${nrf52840_xiao.build_flags}
|
|
||||||
-D P_LORA_TX_LED=11
|
|
||||||
-I variants/ikoka_nano_nrf
|
-I variants/ikoka_nano_nrf
|
||||||
-I src/helpers/nrf52
|
-I src/helpers/nrf52
|
||||||
|
-D P_LORA_TX_LED=11
|
||||||
-D DISPLAY_CLASS=NullDisplayDriver
|
-D DISPLAY_CLASS=NullDisplayDriver
|
||||||
-D RADIO_CLASS=CustomSX1262
|
-D RADIO_CLASS=CustomSX1262
|
||||||
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||||
-D P_LORA_DIO_1=D1
|
-D P_LORA_DIO_1=D1
|
||||||
; -D P_LORA_BUSY=D3
|
-D P_LORA_BUSY=D2
|
||||||
-D P_LORA_BUSY=D2 ; specific to ikoka nano variant.
|
-D P_LORA_RESET=D3
|
||||||
; -D P_LORA_RESET=D2
|
-D P_LORA_NSS=D0
|
||||||
-D P_LORA_RESET=D3 ; specific to ikoka nano variant.
|
|
||||||
; -D P_LORA_NSS=D4
|
|
||||||
-D P_LORA_NSS=D0 ; specific to ikoka nano variant.
|
|
||||||
; -D SX126X_RXEN=D5
|
|
||||||
-D SX126X_RXEN=D7
|
-D SX126X_RXEN=D7
|
||||||
-D SX126X_TXEN=RADIOLIB_NC
|
-D SX126X_TXEN=RADIOLIB_NC
|
||||||
-D SX126X_DIO2_AS_RF_SWITCH=1
|
-D SX126X_DIO2_AS_RF_SWITCH=1
|
||||||
-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 PIN_WIRE_SCL=5 ; specific to ikoka nano variant.
|
-D PIN_WIRE_SCL=5
|
||||||
-D PIN_WIRE_SDA=4 ; specific to ikoka nano variant.
|
-D PIN_WIRE_SDA=4
|
||||||
-D ENV_INCLUDE_AHTX0=1
|
-UENV_INCLUDE_GPS
|
||||||
-D ENV_INCLUDE_BME280=1
|
|
||||||
-D ENV_INCLUDE_INA3221=1
|
|
||||||
-D ENV_INCLUDE_INA219=1
|
|
||||||
debug_tool = jlink
|
debug_tool = jlink
|
||||||
upload_protocol = nrfutil
|
upload_protocol = nrfutil
|
||||||
|
lib_deps = ${nrf52_base.lib_deps}
|
||||||
|
${sensor_base.lib_deps}
|
||||||
;;; abstracted hardware variants
|
|
||||||
|
|
||||||
[ikoka_nano_nrf_e22_22dbm]
|
[ikoka_nano_nrf_e22_22dbm]
|
||||||
extends = ikoka_nano_nrf_baseboard
|
extends = ikoka_nano_nrf
|
||||||
; No PA in this model, full 22dBm
|
; No PA in this model, full 22dBm
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_nano_nrf_baseboard.build_flags}
|
${ikoka_nano_nrf.build_flags}
|
||||||
-D MANUFACTURER_STRING='"Ikoka Nano-E22-22dBm (Xiao_nrf52)"'
|
-D MANUFACTURER_STRING='"Ikoka Nano-E22-22dBm (Xiao_nrf52)"'
|
||||||
-D LORA_TX_POWER=22
|
-D LORA_TX_POWER=22
|
||||||
build_src_filter = ${nrf52840_xiao.build_src_filter}
|
build_src_filter = ${ikoka_nano_nrf.build_src_filter}
|
||||||
+<helpers/*.cpp>
|
+<helpers/*.cpp>
|
||||||
+<helpers/sensors>
|
+<helpers/sensors>
|
||||||
+<helpers/ui/NullDisplayDriver.cpp>
|
+<helpers/ui/NullDisplayDriver.cpp>
|
||||||
+<../variants/ikoka_nano_nrf>
|
+<../variants/ikoka_nano_nrf>
|
||||||
|
|
||||||
[ikoka_nano_nrf_e22_30dbm]
|
[ikoka_nano_nrf_e22_30dbm]
|
||||||
extends = ikoka_nano_nrf_baseboard
|
extends = ikoka_nano_nrf
|
||||||
; limit txpower to 20dBm on E22-900M30S. Anything higher will
|
; limit txpower to 20dBm on E22-900M30S. Anything higher will
|
||||||
; cause distortion in the PA output. 20dBm in -> 30dBm out
|
; cause distortion in the PA output. 20dBm in -> 30dBm out
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_nano_nrf_baseboard.build_flags}
|
${ikoka_nano_nrf.build_flags}
|
||||||
-D MANUFACTURER_STRING='"Ikoka Nano-E22-30dBm (Xiao_nrf52)"'
|
-D MANUFACTURER_STRING='"Ikoka Nano-E22-30dBm (Xiao_nrf52)"'
|
||||||
-D LORA_TX_POWER=20
|
-D LORA_TX_POWER=20
|
||||||
build_src_filter = ${nrf52840_xiao.build_src_filter}
|
build_src_filter = ${ikoka_nano_nrf.build_src_filter}
|
||||||
+<helpers/*.cpp>
|
+<helpers/*.cpp>
|
||||||
+<helpers/sensors>
|
+<helpers/sensors>
|
||||||
+<helpers/ui/NullDisplayDriver.cpp>
|
+<helpers/ui/NullDisplayDriver.cpp>
|
||||||
+<../variants/ikoka_nano_nrf>
|
+<../variants/ikoka_nano_nrf>
|
||||||
|
|
||||||
[ikoka_nano_nrf_e22_33dbm]
|
[ikoka_nano_nrf_e22_33dbm]
|
||||||
extends = ikoka_nano_nrf_baseboard
|
extends = ikoka_nano_nrf
|
||||||
; limit txpower to 9dBm on E22-900M33S to avoid hardware damage
|
; limit txpower to 9dBm on E22-900M33S to avoid hardware damage
|
||||||
; to the rf amplifier frontend. 9dBm in -> 33dBm out
|
; to the rf amplifier frontend. 9dBm in -> 33dBm out
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_nano_nrf_baseboard.build_flags}
|
${ikoka_nano_nrf.build_flags}
|
||||||
-D MANUFACTURER_STRING='"Ikoka Nano-E22-33dBm (Xiao_nrf52)"'
|
-D MANUFACTURER_STRING='"Ikoka Nano-E22-33dBm (Xiao_nrf52)"'
|
||||||
-D LORA_TX_POWER=9
|
-D LORA_TX_POWER=9
|
||||||
build_src_filter = ${nrf52840_xiao.build_src_filter}
|
build_src_filter = ${ikoka_nano_nrf.build_src_filter}
|
||||||
+<helpers/*.cpp>
|
+<helpers/*.cpp>
|
||||||
+<helpers/sensors>
|
+<helpers/sensors>
|
||||||
+<helpers/ui/NullDisplayDriver.cpp>
|
+<helpers/ui/NullDisplayDriver.cpp>
|
||||||
+<../variants/ikoka_nano_nrf>
|
+<../variants/ikoka_nano_nrf>
|
||||||
|
|
||||||
;;; abstracted firmware roles
|
|
||||||
|
|
||||||
[ikoka_nano_nrf_companion_radio_ble]
|
[ikoka_nano_nrf_companion_radio_ble]
|
||||||
extends = ikoka_nano_nrf_baseboard
|
extends = ikoka_nano_nrf
|
||||||
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
|
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
|
||||||
board_upload.maximum_size = 708608
|
board_upload.maximum_size = 708608
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_nano_nrf_baseboard.build_flags}
|
${ikoka_nano_nrf.build_flags}
|
||||||
-D MAX_CONTACTS=350
|
-D MAX_CONTACTS=350
|
||||||
-D MAX_GROUP_CHANNELS=40
|
-D MAX_GROUP_CHANNELS=40
|
||||||
-D BLE_PIN_CODE=123456
|
-D BLE_PIN_CODE=123456
|
||||||
-D OFFLINE_QUEUE_SIZE=256
|
-D OFFLINE_QUEUE_SIZE=256
|
||||||
-I examples/companion_radio/ui-new
|
-I examples/companion_radio/ui-new
|
||||||
|
-D QSPIFLASH=1
|
||||||
; -D BLE_DEBUG_LOGGING=1
|
; -D BLE_DEBUG_LOGGING=1
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${ikoka_nano_nrf_baseboard.build_src_filter}
|
build_src_filter = ${ikoka_nano_nrf.build_src_filter}
|
||||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||||
+<../examples/companion_radio/*.cpp>
|
+<../examples/companion_radio/*.cpp>
|
||||||
+<../examples/companion_radio/ui-new/*.cpp>
|
+<../examples/companion_radio/ui-new/*.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${ikoka_nano_nrf_baseboard.lib_deps}
|
${ikoka_nano_nrf.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
[ikoka_nano_nrf_companion_radio_usb]
|
[ikoka_nano_nrf_companion_radio_usb]
|
||||||
extends = ikoka_nano_nrf_baseboard
|
extends = ikoka_nano_nrf
|
||||||
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
|
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
|
||||||
board_upload.maximum_size = 708608
|
board_upload.maximum_size = 708608
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_nano_nrf_baseboard.build_flags}
|
${ikoka_nano_nrf.build_flags}
|
||||||
-D MAX_CONTACTS=350
|
-D MAX_CONTACTS=350
|
||||||
-D MAX_GROUP_CHANNELS=40
|
-D MAX_GROUP_CHANNELS=40
|
||||||
-I examples/companion_radio/ui-new
|
-I examples/companion_radio/ui-new
|
||||||
|
-D QSPIFLASH=1
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${ikoka_nano_nrf_baseboard.build_src_filter}
|
build_src_filter = ${ikoka_nano_nrf.build_src_filter}
|
||||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||||
+<../examples/companion_radio/*.cpp>
|
+<../examples/companion_radio/*.cpp>
|
||||||
+<../examples/companion_radio/ui-new/*.cpp>
|
+<../examples/companion_radio/ui-new/*.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${ikoka_nano_nrf_baseboard.lib_deps}
|
${ikoka_nano_nrf.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
[ikoka_nano_nrf_repeater]
|
[ikoka_nano_nrf_repeater]
|
||||||
extends = ikoka_nano_nrf_baseboard
|
extends = ikoka_nano_nrf
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_nano_nrf_baseboard.build_flags}
|
${ikoka_nano_nrf.build_flags}
|
||||||
-D ADVERT_NAME='"Ikoka Nano Repeater"'
|
-D ADVERT_NAME='"Ikoka Nano Repeater"'
|
||||||
-D ADVERT_LAT=0.0
|
-D ADVERT_LAT=0.0
|
||||||
-D ADVERT_LON=0.0
|
-D ADVERT_LON=0.0
|
||||||
@@ -153,26 +126,23 @@ build_flags =
|
|||||||
-D MAX_NEIGHBOURS=50
|
-D MAX_NEIGHBOURS=50
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${ikoka_nano_nrf_baseboard.build_src_filter}
|
build_src_filter = ${ikoka_nano_nrf.build_src_filter}
|
||||||
+<../examples/simple_repeater/*.cpp>
|
+<../examples/simple_repeater/*.cpp>
|
||||||
|
|
||||||
[ikoka_nano_nrf_room_server]
|
[ikoka_nano_nrf_room_server]
|
||||||
extends = ikoka_nano_nrf_baseboard
|
extends = ikoka_nano_nrf
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_nano_nrf_baseboard.build_flags}
|
${ikoka_nano_nrf.build_flags}
|
||||||
-D ADVERT_NAME='"Ikoka Nano Room"'
|
-D ADVERT_NAME='"Ikoka Nano Room"'
|
||||||
-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 MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${ikoka_nano_nrf_baseboard.build_src_filter}
|
build_src_filter = ${ikoka_nano_nrf.build_src_filter}
|
||||||
+<../examples/simple_room_server/*.cpp>
|
+<../examples/simple_room_server/*.cpp>
|
||||||
|
|
||||||
;;; hardware + firmware variants
|
|
||||||
|
|
||||||
;;; 22dBm EBYTE E22-900M22 variants
|
;;; 22dBm EBYTE E22-900M22 variants
|
||||||
|
|
||||||
[env:ikoka_nano_nrf_22dbm_companion_radio_usb]
|
[env:ikoka_nano_nrf_22dbm_companion_radio_usb]
|
||||||
extends =
|
extends =
|
||||||
ikoka_nano_nrf_e22_22dbm
|
ikoka_nano_nrf_e22_22dbm
|
||||||
@@ -219,7 +189,6 @@ build_src_filter =
|
|||||||
|
|
||||||
|
|
||||||
;;; 30dBm EBYTE E22-900M30 variants
|
;;; 30dBm EBYTE E22-900M30 variants
|
||||||
|
|
||||||
[env:ikoka_nano_nrf_30dbm_companion_radio_usb]
|
[env:ikoka_nano_nrf_30dbm_companion_radio_usb]
|
||||||
extends =
|
extends =
|
||||||
ikoka_nano_nrf_e22_30dbm
|
ikoka_nano_nrf_e22_30dbm
|
||||||
@@ -266,7 +235,6 @@ build_src_filter =
|
|||||||
|
|
||||||
|
|
||||||
;;; 33dBm EBYTE E22-900M33 variants
|
;;; 33dBm EBYTE E22-900M33 variants
|
||||||
|
|
||||||
[env:ikoka_nano_nrf_33dbm_companion_radio_usb]
|
[env:ikoka_nano_nrf_33dbm_companion_radio_usb]
|
||||||
extends =
|
extends =
|
||||||
ikoka_nano_nrf_e22_33dbm
|
ikoka_nano_nrf_e22_33dbm
|
||||||
|
|||||||
@@ -1,34 +1,15 @@
|
|||||||
[nrf52840_xiao]
|
[ikoka_stick_nrf]
|
||||||
extends = nrf52_base
|
extends = nrf52_base
|
||||||
platform_packages =
|
|
||||||
toolchain-gccarmnoneeabi@~1.100301.0
|
|
||||||
framework-arduinoadafruitnrf52
|
|
||||||
board = seeed-xiao-afruitnrf52-nrf52840
|
board = seeed-xiao-afruitnrf52-nrf52840
|
||||||
board_build.ldscript = boards/nrf52840_s140_v7.ld
|
board_build.ldscript = boards/nrf52840_s140_v7.ld
|
||||||
build_flags = ${nrf52_base.build_flags}
|
build_flags = ${nrf52_base.build_flags}
|
||||||
|
${sensor_base.build_flags}
|
||||||
-D NRF52_PLATFORM -D XIAO_NRF52
|
-D NRF52_PLATFORM -D XIAO_NRF52
|
||||||
-I lib/nrf52/s140_nrf52_7.3.0_API/include
|
-I lib/nrf52/s140_nrf52_7.3.0_API/include
|
||||||
-I lib/nrf52/s140_nrf52_7.3.0_API/include/nrf52
|
-I lib/nrf52/s140_nrf52_7.3.0_API/include/nrf52
|
||||||
lib_ignore =
|
|
||||||
BluetoothOTA
|
|
||||||
lvgl
|
|
||||||
lib5b4
|
|
||||||
lib_deps =
|
|
||||||
${nrf52_base.lib_deps}
|
|
||||||
rweather/Crypto @ ^0.4.0
|
|
||||||
adafruit/Adafruit INA3221 Library @ ^1.0.1
|
|
||||||
adafruit/Adafruit INA219 @ ^1.2.3
|
|
||||||
adafruit/Adafruit AHTX0 @ ^2.0.5
|
|
||||||
adafruit/Adafruit BME280 Library @ ^2.3.0
|
|
||||||
adafruit/Adafruit SSD1306 @ ^2.5.13
|
|
||||||
|
|
||||||
[ikoka_stick_nrf_baseboard]
|
|
||||||
extends = nrf52840_xiao
|
|
||||||
;board_build.ldscript = boards/nrf52840_s140_v7.ld
|
|
||||||
build_flags = ${nrf52840_xiao.build_flags}
|
|
||||||
-D P_LORA_TX_LED=11
|
|
||||||
-I variants/ikoka_stick_nrf
|
-I variants/ikoka_stick_nrf
|
||||||
-I src/helpers/nrf52
|
-I src/helpers/nrf52
|
||||||
|
-D P_LORA_TX_LED=11
|
||||||
-D DISPLAY_CLASS=SSD1306Display
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
-D DISPLAY_ROTATION=2
|
-D DISPLAY_ROTATION=2
|
||||||
-D RADIO_CLASS=CustomSX1262
|
-D RADIO_CLASS=CustomSX1262
|
||||||
@@ -46,24 +27,17 @@ build_flags = ${nrf52840_xiao.build_flags}
|
|||||||
-D PIN_USER_BTN=0
|
-D PIN_USER_BTN=0
|
||||||
-D PIN_WIRE_SCL=7
|
-D PIN_WIRE_SCL=7
|
||||||
-D PIN_WIRE_SDA=6
|
-D PIN_WIRE_SDA=6
|
||||||
-D ENV_INCLUDE_AHTX0=1
|
lib_deps = ${nrf52_base.lib_deps}
|
||||||
-D ENV_INCLUDE_BME280=1
|
${sensor_base.lib_deps}
|
||||||
-D ENV_INCLUDE_INA3221=1
|
|
||||||
-D ENV_INCLUDE_INA219=1
|
|
||||||
debug_tool = jlink
|
|
||||||
upload_protocol = nrfutil
|
|
||||||
|
|
||||||
|
|
||||||
;;; abstracted hardware variants
|
|
||||||
|
|
||||||
[ikoka_stick_nrf_e22_22dbm]
|
[ikoka_stick_nrf_e22_22dbm]
|
||||||
extends = ikoka_stick_nrf_baseboard
|
extends = ikoka_stick_nrf
|
||||||
; No PA in this model, full 22dBm
|
; No PA in this model, full 22dBm
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_stick_nrf_baseboard.build_flags}
|
${ikoka_stick_nrf.build_flags}
|
||||||
-D MANUFACTURER_STRING='"Ikoka Stick-E22-22dBm (Xiao_nrf52)"'
|
-D MANUFACTURER_STRING='"Ikoka Stick-E22-22dBm (Xiao_nrf52)"'
|
||||||
-D LORA_TX_POWER=22
|
-D LORA_TX_POWER=22
|
||||||
build_src_filter = ${nrf52840_xiao.build_src_filter}
|
build_src_filter = ${ikoka_stick_nrf.build_src_filter}
|
||||||
+<helpers/*.cpp>
|
+<helpers/*.cpp>
|
||||||
+<helpers/sensors>
|
+<helpers/sensors>
|
||||||
+<helpers/ui/MomentaryButton.cpp>
|
+<helpers/ui/MomentaryButton.cpp>
|
||||||
@@ -71,14 +45,14 @@ build_src_filter = ${nrf52840_xiao.build_src_filter}
|
|||||||
+<../variants/ikoka_stick_nrf>
|
+<../variants/ikoka_stick_nrf>
|
||||||
|
|
||||||
[ikoka_stick_nrf_e22_30dbm]
|
[ikoka_stick_nrf_e22_30dbm]
|
||||||
extends = ikoka_stick_nrf_baseboard
|
extends = ikoka_stick_nrf
|
||||||
; limit txpower to 20dBm on E22-900M30S. Anything higher will
|
; limit txpower to 20dBm on E22-900M30S. Anything higher will
|
||||||
; cause distortion in the PA output. 20dBm in -> 30dBm out
|
; cause distortion in the PA output. 20dBm in -> 30dBm out
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_stick_nrf_baseboard.build_flags}
|
${ikoka_stick_nrf.build_flags}
|
||||||
-D MANUFACTURER_STRING='"Ikoka Stick-E22-30dBm (Xiao_nrf52)"'
|
-D MANUFACTURER_STRING='"Ikoka Stick-E22-30dBm (Xiao_nrf52)"'
|
||||||
-D LORA_TX_POWER=20
|
-D LORA_TX_POWER=20
|
||||||
build_src_filter = ${nrf52840_xiao.build_src_filter}
|
build_src_filter = ${ikoka_stick_nrf.build_src_filter}
|
||||||
+<helpers/*.cpp>
|
+<helpers/*.cpp>
|
||||||
+<helpers/sensors>
|
+<helpers/sensors>
|
||||||
+<helpers/ui/MomentaryButton.cpp>
|
+<helpers/ui/MomentaryButton.cpp>
|
||||||
@@ -86,14 +60,14 @@ build_src_filter = ${nrf52840_xiao.build_src_filter}
|
|||||||
+<../variants/ikoka_stick_nrf>
|
+<../variants/ikoka_stick_nrf>
|
||||||
|
|
||||||
[ikoka_stick_nrf_e22_33dbm]
|
[ikoka_stick_nrf_e22_33dbm]
|
||||||
extends = ikoka_stick_nrf_baseboard
|
extends = ikoka_stick_nrf
|
||||||
; limit txpower to 9dBm on E22-900M33S to avoid hardware damage
|
; limit txpower to 9dBm on E22-900M33S to avoid hardware damage
|
||||||
; to the rf amplifier frontend. 9dBm in -> 33dBm out
|
; to the rf amplifier frontend. 9dBm in -> 33dBm out
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_stick_nrf_baseboard.build_flags}
|
${ikoka_stick_nrf.build_flags}
|
||||||
-D MANUFACTURER_STRING='"Ikoka Stick-E22-33dBm (Xiao_nrf52)"'
|
-D MANUFACTURER_STRING='"Ikoka Stick-E22-33dBm (Xiao_nrf52)"'
|
||||||
-D LORA_TX_POWER=9
|
-D LORA_TX_POWER=9
|
||||||
build_src_filter = ${nrf52840_xiao.build_src_filter}
|
build_src_filter = ${ikoka_stick_nrf.build_src_filter}
|
||||||
+<helpers/*.cpp>
|
+<helpers/*.cpp>
|
||||||
+<helpers/sensors>
|
+<helpers/sensors>
|
||||||
+<helpers/ui/MomentaryButton.cpp>
|
+<helpers/ui/MomentaryButton.cpp>
|
||||||
@@ -103,50 +77,52 @@ build_src_filter = ${nrf52840_xiao.build_src_filter}
|
|||||||
;;; abstracted firmware roles
|
;;; abstracted firmware roles
|
||||||
|
|
||||||
[ikoka_stick_nrf_companion_radio_ble]
|
[ikoka_stick_nrf_companion_radio_ble]
|
||||||
extends = ikoka_stick_nrf_baseboard
|
extends = ikoka_stick_nrf
|
||||||
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
|
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
|
||||||
board_upload.maximum_size = 708608
|
board_upload.maximum_size = 708608
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_stick_nrf_baseboard.build_flags}
|
${ikoka_stick_nrf.build_flags}
|
||||||
-D MAX_CONTACTS=350
|
-D MAX_CONTACTS=350
|
||||||
-D MAX_GROUP_CHANNELS=40
|
-D MAX_GROUP_CHANNELS=40
|
||||||
-D BLE_PIN_CODE=123456
|
-D BLE_PIN_CODE=123456
|
||||||
-D OFFLINE_QUEUE_SIZE=256
|
-D OFFLINE_QUEUE_SIZE=256
|
||||||
-I examples/companion_radio/ui-new
|
-I examples/companion_radio/ui-new
|
||||||
|
-D QSPIFLASH=1
|
||||||
; -D BLE_DEBUG_LOGGING=1
|
; -D BLE_DEBUG_LOGGING=1
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${ikoka_stick_nrf_baseboard.build_src_filter}
|
build_src_filter = ${ikoka_stick_nrf.build_src_filter}
|
||||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||||
+<../examples/companion_radio/*.cpp>
|
+<../examples/companion_radio/*.cpp>
|
||||||
+<../examples/companion_radio/ui-new/*.cpp>
|
+<../examples/companion_radio/ui-new/*.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${ikoka_stick_nrf_baseboard.lib_deps}
|
${ikoka_stick_nrf.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
[ikoka_stick_nrf_companion_radio_usb]
|
[ikoka_stick_nrf_companion_radio_usb]
|
||||||
extends = ikoka_stick_nrf_baseboard
|
extends = ikoka_stick_nrf
|
||||||
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
|
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
|
||||||
board_upload.maximum_size = 708608
|
board_upload.maximum_size = 708608
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_stick_nrf_baseboard.build_flags}
|
${ikoka_stick_nrf.build_flags}
|
||||||
-D MAX_CONTACTS=350
|
-D MAX_CONTACTS=350
|
||||||
-D MAX_GROUP_CHANNELS=40
|
-D MAX_GROUP_CHANNELS=40
|
||||||
-I examples/companion_radio/ui-new
|
-I examples/companion_radio/ui-new
|
||||||
|
-D QSPIFLASH=1
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${ikoka_stick_nrf_baseboard.build_src_filter}
|
build_src_filter = ${ikoka_stick_nrf.build_src_filter}
|
||||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||||
+<../examples/companion_radio/*.cpp>
|
+<../examples/companion_radio/*.cpp>
|
||||||
+<../examples/companion_radio/ui-new/*.cpp>
|
+<../examples/companion_radio/ui-new/*.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${ikoka_stick_nrf_baseboard.lib_deps}
|
${ikoka_stick_nrf.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
[ikoka_stick_nrf_repeater]
|
[ikoka_stick_nrf_repeater]
|
||||||
extends = ikoka_stick_nrf_baseboard
|
extends = ikoka_stick_nrf
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_stick_nrf_baseboard.build_flags}
|
${ikoka_stick_nrf.build_flags}
|
||||||
-D ADVERT_NAME='"Ikoka Stick Repeater"'
|
-D ADVERT_NAME='"Ikoka Stick Repeater"'
|
||||||
-D ADVERT_LAT=0.0
|
-D ADVERT_LAT=0.0
|
||||||
-D ADVERT_LON=0.0
|
-D ADVERT_LON=0.0
|
||||||
@@ -154,21 +130,21 @@ build_flags =
|
|||||||
-D MAX_NEIGHBOURS=50
|
-D MAX_NEIGHBOURS=50
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${ikoka_stick_nrf_baseboard.build_src_filter}
|
build_src_filter = ${ikoka_stick_nrf.build_src_filter}
|
||||||
+<helpers/ui/SSD1306Display.cpp>
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
+<../examples/simple_repeater/*.cpp>
|
+<../examples/simple_repeater/*.cpp>
|
||||||
|
|
||||||
[ikoka_stick_nrf_room_server]
|
[ikoka_stick_nrf_room_server]
|
||||||
extends = ikoka_stick_nrf_baseboard
|
extends = ikoka_stick_nrf
|
||||||
build_flags =
|
build_flags =
|
||||||
${ikoka_stick_nrf_baseboard.build_flags}
|
${ikoka_stick_nrf.build_flags}
|
||||||
-D ADVERT_NAME='"Ikoka Stick Room"'
|
-D ADVERT_NAME='"Ikoka Stick Room"'
|
||||||
-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 MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${ikoka_stick_nrf_baseboard.build_src_filter}
|
build_src_filter = ${ikoka_stick_nrf.build_src_filter}
|
||||||
+<../examples/simple_room_server/*.cpp>
|
+<../examples/simple_room_server/*.cpp>
|
||||||
|
|
||||||
;;; hardware + firmware variants
|
;;; hardware + firmware variants
|
||||||
|
|||||||
@@ -138,8 +138,6 @@ build_flags =
|
|||||||
-D DISPLAY_CLASS=SSD1306Display
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
-D MAX_CONTACTS=350
|
-D MAX_CONTACTS=350
|
||||||
-D MAX_GROUP_CHANNELS=40
|
-D MAX_GROUP_CHANNELS=40
|
||||||
-D MESH_PACKET_LOGGING=1
|
|
||||||
-D MESH_DEBUG=1
|
|
||||||
build_src_filter = ${LilyGo_T3S3_sx1276.build_src_filter}
|
build_src_filter = ${LilyGo_T3S3_sx1276.build_src_filter}
|
||||||
+<helpers/ui/SSD1306Display.cpp>
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
+<helpers/ui/MomentaryButton.cpp>
|
+<helpers/ui/MomentaryButton.cpp>
|
||||||
|
|||||||
Reference in New Issue
Block a user