include a human readable name for each channel

This commit is contained in:
geeksville 2020-02-11 19:06:12 -08:00
parent 03eaef2c8f
commit a0f2d1f18a
5 changed files with 24 additions and 10 deletions

View File

@ -1,6 +1,5 @@
# High priority # High priority
* platformio sdkconfig CONFIG_PM and turn on modem sleep mode
* finish power measurements and est battery life * finish power measurements and est battery life
* have node info screen show real info (including time since last contact, distance and heading) * have node info screen show real info (including time since last contact, distance and heading)
* make debug info screen show real data (including battery level & charging) * make debug info screen show real data (including battery level & charging)
@ -27,7 +26,8 @@
# Low power consumption tasks # Low power consumption tasks
* keep cpu 100% in sleep (some sort - deep?) Sleep until irq from radio wakes it (make plan based on power draw spreadsheet). Then stay awake for 30 secs to attempt delivery to phone. * platformio sdkconfig CONFIG_PM and turn on modem sleep mode
* keep cpu 100% in deepsleep until irq from radio wakes it. Then stay awake for 30 secs to attempt delivery to phone.
* have radiohead ISR send messages to RX queue directly, to allow that thread to block until we have something to send * have radiohead ISR send messages to RX queue directly, to allow that thread to block until we have something to send
* use https://lastminuteengineers.com/esp32-sleep-modes-power-consumption/ association sleep pattern to save power - but see https://github.com/espressif/esp-idf/issues/2070 and https://esp32.com/viewtopic.php?f=13&t=12182 it seems with BLE on the 'easy' draw people are getting is 80mA * use https://lastminuteengineers.com/esp32-sleep-modes-power-consumption/ association sleep pattern to save power - but see https://github.com/espressif/esp-idf/issues/2070 and https://esp32.com/viewtopic.php?f=13&t=12182 it seems with BLE on the 'easy' draw people are getting is 80mA
* stop using loop() instead use a job queue and let cpu sleep * stop using loop() instead use a job queue and let cpu sleep
@ -59,6 +59,7 @@ until the phone pulls those packets. Ever so often power on bluetooth just so w
# Low priority # Low priority
* increase the max charging rate a bit for 18650s, currently it limits to 180mA (at 4V). Work backwards from the 500mA USB limit (at 5V) and let the AXP charge at that rate.
* add receive timestamps to messages, inserted by esp32 when message is received but then shown on the phone * add receive timestamps to messages, inserted by esp32 when message is received but then shown on the phone
* if radio params change fundamentally, discard the nodedb * if radio params change fundamentally, discard the nodedb
* discard very old nodedb records (> 1wk) * discard very old nodedb records (> 1wk)

View File

@ -11,6 +11,10 @@
#define DEFAULT_CHANNEL_NUM 3 // we randomly pick one #define DEFAULT_CHANNEL_NUM 3 // we randomly pick one
/// 16 bytes of random PSK for our _public_ default channel that all devices power up on
static const uint8_t defaultpsk[] = { 0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0x59, 0xf0, 0xbc, 0xff, 0xab, 0xcf, 0x4e, 0x69, 0xbf };
/** /**
* ## LoRaWAN for North America * ## LoRaWAN for North America
@ -35,6 +39,8 @@ MeshRadio::MeshRadio(MemoryPool<MeshPacket> &_pool, PointerQueue<MeshPacket> &_r
channelSettings.tx_power = 23; channelSettings.tx_power = 23;
channelSettings.channel_num = DEFAULT_CHANNEL_NUM; channelSettings.channel_num = DEFAULT_CHANNEL_NUM;
memcpy(&channelSettings.psk, &defaultpsk, sizeof(channelSettings.psk));
strcpy(channelSettings.name, "Default");
} }
bool MeshRadio::init() bool MeshRadio::init()

View File

@ -444,7 +444,7 @@ void loop()
if (!wasPressed) if (!wasPressed)
{ // just started a new press { // just started a new press
DEBUG_MSG("pressing\n"); DEBUG_MSG("pressing\n");
esp_pm_dump_locks(stdout); // FIXME, do this someplace better // esp_pm_dump_locks(stdout); // FIXME, do this someplace better
wasPressed = true; wasPressed = true;
minPressMs = millis() + 3000; minPressMs = millis() + 3000;
screen_press(); screen_press();

View File

@ -39,6 +39,7 @@ typedef struct _ChannelSettings {
uint32_t channel_num; uint32_t channel_num;
ChannelSettings_ModemConfig modem_config; ChannelSettings_ModemConfig modem_config;
pb_byte_t psk[16]; pb_byte_t psk[16];
char name[12];
} ChannelSettings; } ChannelSettings;
typedef PB_BYTES_ARRAY_T(200) Data_payload_t; typedef PB_BYTES_ARRAY_T(200) Data_payload_t;
@ -159,7 +160,7 @@ typedef struct _ToRadio {
#define User_init_default {"", "", "", {0}} #define User_init_default {"", "", "", {0}}
#define SubPacket_init_default {0, {Position_init_default}} #define SubPacket_init_default {0, {Position_init_default}}
#define MeshPacket_init_default {0, 0, false, SubPacket_init_default, 0} #define MeshPacket_init_default {0, 0, false, SubPacket_init_default, 0}
#define ChannelSettings_init_default {0, 0, _ChannelSettings_ModemConfig_MIN, {0}} #define ChannelSettings_init_default {0, 0, _ChannelSettings_ModemConfig_MIN, {0}, ""}
#define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default, false, ChannelSettings_init_default} #define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default, false, ChannelSettings_init_default}
#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0} #define RadioConfig_UserPreferences_init_default {0, 0, 0, 0}
#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0, 0} #define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0, 0}
@ -172,7 +173,7 @@ typedef struct _ToRadio {
#define User_init_zero {"", "", "", {0}} #define User_init_zero {"", "", "", {0}}
#define SubPacket_init_zero {0, {Position_init_zero}} #define SubPacket_init_zero {0, {Position_init_zero}}
#define MeshPacket_init_zero {0, 0, false, SubPacket_init_zero, 0} #define MeshPacket_init_zero {0, 0, false, SubPacket_init_zero, 0}
#define ChannelSettings_init_zero {0, 0, _ChannelSettings_ModemConfig_MIN, {0}} #define ChannelSettings_init_zero {0, 0, _ChannelSettings_ModemConfig_MIN, {0}, ""}
#define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero, false, ChannelSettings_init_zero} #define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero, false, ChannelSettings_init_zero}
#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0} #define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0}
#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0, 0} #define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0, 0}
@ -186,6 +187,7 @@ typedef struct _ToRadio {
#define ChannelSettings_channel_num_tag 2 #define ChannelSettings_channel_num_tag 2
#define ChannelSettings_modem_config_tag 3 #define ChannelSettings_modem_config_tag 3
#define ChannelSettings_psk_tag 4 #define ChannelSettings_psk_tag 4
#define ChannelSettings_name_tag 5
#define Data_typ_tag 1 #define Data_typ_tag 1
#define Data_payload_tag 2 #define Data_payload_tag 2
#define MyNodeInfo_my_node_num_tag 1 #define MyNodeInfo_my_node_num_tag 1
@ -275,7 +277,8 @@ X(a, STATIC, SINGULAR, UINT64, rx_time, 4)
X(a, STATIC, SINGULAR, INT32, tx_power, 1) \ X(a, STATIC, SINGULAR, INT32, tx_power, 1) \
X(a, STATIC, SINGULAR, UINT32, channel_num, 2) \ X(a, STATIC, SINGULAR, UINT32, channel_num, 2) \
X(a, STATIC, SINGULAR, UENUM, modem_config, 3) \ X(a, STATIC, SINGULAR, UENUM, modem_config, 3) \
X(a, STATIC, SINGULAR, FIXED_LENGTH_BYTES, psk, 4) X(a, STATIC, SINGULAR, FIXED_LENGTH_BYTES, psk, 4) \
X(a, STATIC, SINGULAR, STRING, name, 5)
#define ChannelSettings_CALLBACK NULL #define ChannelSettings_CALLBACK NULL
#define ChannelSettings_DEFAULT NULL #define ChannelSettings_DEFAULT NULL
@ -376,12 +379,12 @@ extern const pb_msgdesc_t ToRadio_msg;
#define User_size 72 #define User_size 72
#define SubPacket_size 208 #define SubPacket_size 208
#define MeshPacket_size 244 #define MeshPacket_size 244
#define ChannelSettings_size 37 #define ChannelSettings_size 50
#define RadioConfig_size 59 #define RadioConfig_size 72
#define RadioConfig_UserPreferences_size 18 #define RadioConfig_UserPreferences_size 18
#define NodeInfo_size 162 #define NodeInfo_size 162
#define MyNodeInfo_size 13 #define MyNodeInfo_size 13
#define DeviceState_size 13336 #define DeviceState_size 13349
#define FromRadio_size 253 #define FromRadio_size 253
#define ToRadio_size 247 #define ToRadio_size 247

View File

@ -304,10 +304,14 @@ void drawDebugInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, i
static char usersStr[20]; static char usersStr[20];
snprintf(usersStr, sizeof(usersStr), "Users %d/%d", nodeDB.getNumOnlineNodes(), nodeDB.getNumNodes()); snprintf(usersStr, sizeof(usersStr), "Users %d/%d", nodeDB.getNumOnlineNodes(), nodeDB.getNumNodes());
static char channelStr[20];
snprintf(channelStr, sizeof(channelStr), "Channel %s", channelSettings.name);
const char *fields[] = { const char *fields[] = {
"Batt 89%", "Batt 89%",
"GPS 75%", "GPS 75%",
usersStr, usersStr,
channelStr,
NULL}; NULL};
uint32_t yo = drawRows(display, x, y, fields); uint32_t yo = drawRows(display, x, y, fields);