ESP32 platform update; show more Lora Params
This commit is contained in:
parent
1aa7a69131
commit
2cb5325181
@ -49,7 +49,7 @@ void IRAM_ATTR myRxCallback(void *pUserData, uint8_t port,
|
|||||||
void IRAM_ATTR myTxCallback(void *pUserData, int fSuccess);
|
void IRAM_ATTR myTxCallback(void *pUserData, int fSuccess);
|
||||||
void mac_decode(const uint8_t cmd[], const uint8_t cmdlen, const mac_t table[],
|
void mac_decode(const uint8_t cmd[], const uint8_t cmdlen, const mac_t table[],
|
||||||
const uint8_t tablesize);
|
const uint8_t tablesize);
|
||||||
uint8_t getBattLevel(void);
|
//u1_t os_getBattLevel(void);
|
||||||
const char *getSfName(rps_t rps);
|
const char *getSfName(rps_t rps);
|
||||||
const char *getBwName(rps_t rps);
|
const char *getBwName(rps_t rps);
|
||||||
const char *getCrName(rps_t rps);
|
const char *getCrName(rps_t rps);
|
||||||
|
@ -45,15 +45,15 @@ description = Paxcounter is a device for metering passenger flows in realtime. I
|
|||||||
|
|
||||||
[common]
|
[common]
|
||||||
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
||||||
release_version = 1.9.90
|
release_version = 1.9.91
|
||||||
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
|
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
|
||||||
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
||||||
debug_level = 2
|
debug_level = 3
|
||||||
extra_scripts = pre:build.py
|
extra_scripts = pre:build.py
|
||||||
otakeyfile = ota.conf
|
otakeyfile = ota.conf
|
||||||
lorakeyfile = loraconf.h
|
lorakeyfile = loraconf.h
|
||||||
lmicconfigfile = lmic_config.h
|
lmicconfigfile = lmic_config.h
|
||||||
platform_espressif32 = espressif32@1.11.1
|
platform_espressif32 = espressif32@1.11.2
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
upload_speed = 115200
|
upload_speed = 115200
|
||||||
lib_deps_lora =
|
lib_deps_lora =
|
||||||
@ -76,7 +76,7 @@ lib_deps_sensors =
|
|||||||
lib_deps_basic =
|
lib_deps_basic =
|
||||||
ArduinoJson@^5.13.1
|
ArduinoJson@^5.13.1
|
||||||
76@>=1.2.4 ; #76 Timezone by Jack Christensen
|
76@>=1.2.4 ; #76 Timezone by Jack Christensen
|
||||||
274@>=2.3.3 ; #274 RTC by Michael Miller
|
274@>=2.3.4 ; #274 RTC by Michael Miller
|
||||||
SimpleButton
|
SimpleButton
|
||||||
AXP202X_Library@>=1.1.0 ; AXP202 PMU lib by Lewis He
|
AXP202X_Library@>=1.1.0 ; AXP202 PMU lib by Lewis He
|
||||||
esp32-micro-sdcard
|
esp32-micro-sdcard
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
// Basic Config
|
// Basic Config
|
||||||
#if (HAS_LORA)
|
#if (HAS_LORA)
|
||||||
#include "lorawan.h"
|
#include "lorawan.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
// Local logging Tag
|
// Local logging Tag
|
||||||
static const char TAG[] = "lora";
|
static const char TAG[] = "lora";
|
||||||
|
|
||||||
#if (HAS_LORA)
|
|
||||||
|
|
||||||
#if CLOCK_ERROR_PROCENTAGE > 7
|
#if CLOCK_ERROR_PROCENTAGE > 7
|
||||||
#warning CLOCK_ERROR_PROCENTAGE value in lmic_config.h is too high; values > 7 will cause side effects
|
#warning CLOCK_ERROR_PROCENTAGE value in lmic_config.h is too high; values > 7 will cause side effects
|
||||||
#endif
|
#endif
|
||||||
@ -101,8 +98,10 @@ void lora_setupForNetwork(bool preJoin) {
|
|||||||
if (!cfg.adrmode)
|
if (!cfg.adrmode)
|
||||||
LMIC_setDrTxpow(assertDR(cfg.loradr), cfg.txpower);
|
LMIC_setDrTxpow(assertDR(cfg.loradr), cfg.txpower);
|
||||||
// show current devaddr
|
// show current devaddr
|
||||||
ESP_LOGI(TAG, "DEVaddr: %08X", LMIC.devaddr);
|
ESP_LOGI(TAG, "DEVaddr: 0x%08X | Network ID: 0x%03X | Network Type: %d",
|
||||||
ESP_LOGI(TAG, "Radio parameters: %s / %s / %s",
|
LMIC.devaddr, LMIC.netid & 0x001FFFFF, LMIC.netid & 0x00E00000);
|
||||||
|
ESP_LOGI(TAG, "RSSI: %d | SNR: %d", LMIC.rssi, LMIC.snr / 4);
|
||||||
|
ESP_LOGI(TAG, "Radio parameters: %s | %s | %s",
|
||||||
getSfName(updr2rps(LMIC.datarate)),
|
getSfName(updr2rps(LMIC.datarate)),
|
||||||
getBwName(updr2rps(LMIC.datarate)),
|
getBwName(updr2rps(LMIC.datarate)),
|
||||||
getCrName(updr2rps(LMIC.datarate)));
|
getCrName(updr2rps(LMIC.datarate)));
|
||||||
@ -372,7 +371,7 @@ void lora_queuereset(void) { xQueueReset(LoraSendQueue); }
|
|||||||
|
|
||||||
#if (TIME_SYNC_LORAWAN)
|
#if (TIME_SYNC_LORAWAN)
|
||||||
void IRAM_ATTR user_request_network_time_callback(void *pVoidUserUTCTime,
|
void IRAM_ATTR user_request_network_time_callback(void *pVoidUserUTCTime,
|
||||||
int flagSuccess) {
|
int flagSuccess) {
|
||||||
// Explicit conversion from void* to uint32_t* to avoid compiler errors
|
// Explicit conversion from void* to uint32_t* to avoid compiler errors
|
||||||
time_t *pUserUTCTime = (time_t *)pVoidUserUTCTime;
|
time_t *pUserUTCTime = (time_t *)pVoidUserUTCTime;
|
||||||
|
|
||||||
@ -503,7 +502,7 @@ void myEventCallback(void *pUserData, ev_t ev) {
|
|||||||
|
|
||||||
// receive message handler
|
// receive message handler
|
||||||
void myRxCallback(void *pUserData, uint8_t port, const uint8_t *pMsg,
|
void myRxCallback(void *pUserData, uint8_t port, const uint8_t *pMsg,
|
||||||
size_t nMsg) {
|
size_t nMsg) {
|
||||||
|
|
||||||
// display type of received data
|
// display type of received data
|
||||||
if (nMsg)
|
if (nMsg)
|
||||||
@ -601,32 +600,6 @@ void mac_decode(const uint8_t cmd[], const uint8_t cmdlen, const mac_t table[],
|
|||||||
|
|
||||||
} // mac_decode()
|
} // mac_decode()
|
||||||
|
|
||||||
uint8_t getBattLevel() {
|
|
||||||
/*
|
|
||||||
return values:
|
|
||||||
MCMD_DEVS_EXT_POWER = 0x00, // external power supply
|
|
||||||
MCMD_DEVS_BATT_MIN = 0x01, // min battery value
|
|
||||||
MCMD_DEVS_BATT_MAX = 0xFE, // max battery value
|
|
||||||
MCMD_DEVS_BATT_NOINFO = 0xFF, // unknown battery level
|
|
||||||
*/
|
|
||||||
#if (defined HAS_PMU || defined BAT_MEASURE_ADC)
|
|
||||||
uint16_t voltage = read_voltage();
|
|
||||||
|
|
||||||
switch (voltage) {
|
|
||||||
case 0:
|
|
||||||
return MCMD_DEVS_BATT_NOINFO;
|
|
||||||
case 0xffff:
|
|
||||||
return MCMD_DEVS_EXT_POWER;
|
|
||||||
default:
|
|
||||||
return (voltage > OTA_MIN_BATT ? MCMD_DEVS_BATT_MAX : MCMD_DEVS_BATT_MIN);
|
|
||||||
}
|
|
||||||
#else // we don't have any info on battery level
|
|
||||||
return MCMD_DEVS_BATT_NOINFO;
|
|
||||||
#endif
|
|
||||||
} // getBattLevel()
|
|
||||||
|
|
||||||
// u1_t os_getBattLevel(void) { return getBattLevel(); };
|
|
||||||
|
|
||||||
const char *getSfName(rps_t rps) {
|
const char *getSfName(rps_t rps) {
|
||||||
const char *const t[] = {"FSK", "SF7", "SF8", "SF9",
|
const char *const t[] = {"FSK", "SF7", "SF8", "SF9",
|
||||||
"SF10", "SF11", "SF12", "SF?"};
|
"SF10", "SF11", "SF12", "SF?"};
|
||||||
@ -643,4 +616,30 @@ const char *getCrName(rps_t rps) {
|
|||||||
return t[getCr(rps)];
|
return t[getCr(rps)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
u1_t os_getBattLevel() {
|
||||||
|
|
||||||
|
//return values:
|
||||||
|
//MCMD_DEVS_EXT_POWER = 0x00, // external power supply
|
||||||
|
//MCMD_DEVS_BATT_MIN = 0x01, // min battery value
|
||||||
|
//MCMD_DEVS_BATT_MAX = 0xFE, // max battery value
|
||||||
|
//MCMD_DEVS_BATT_NOINFO = 0xFF, // unknown battery level
|
||||||
|
|
||||||
|
#if (defined HAS_PMU || defined BAT_MEASURE_ADC)
|
||||||
|
uint16_t voltage = read_voltage();
|
||||||
|
|
||||||
|
switch (voltage) {
|
||||||
|
case 0:
|
||||||
|
return MCMD_DEVS_BATT_NOINFO;
|
||||||
|
case 0xffff:
|
||||||
|
return MCMD_DEVS_EXT_POWER;
|
||||||
|
default:
|
||||||
|
return (voltage > OTA_MIN_BATT ? MCMD_DEVS_BATT_MAX : MCMD_DEVS_BATT_MIN);
|
||||||
|
}
|
||||||
|
#else // we don't have any info on battery level
|
||||||
|
return MCMD_DEVS_BATT_NOINFO;
|
||||||
|
#endif
|
||||||
|
} // getBattLevel()
|
||||||
|
*/
|
||||||
|
|
||||||
#endif // HAS_LORA
|
#endif // HAS_LORA
|
Loading…
Reference in New Issue
Block a user