commit
e8f247b288
@ -907,7 +907,7 @@ static ostime_t nextJoinState (void) {
|
||||
} else {
|
||||
LMIC.txChnl = os_getRndU1() & 0x3F;
|
||||
s1_t dr = DR_SF7 - ++LMIC.txCnt;
|
||||
if( dr < DR_SF10 ) {
|
||||
if( LMIC.txCnt > DR_SF7 ) {
|
||||
dr = DR_SF10;
|
||||
failed = 1; // All DR exhausted - signal failed
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng
|
||||
|
||||
[common]
|
||||
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
||||
release_version = 1.5.7
|
||||
release_version = 1.5.8
|
||||
; 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
|
||||
debug_level = 0
|
||||
|
@ -49,4 +49,9 @@ uint16_t read_voltage() {
|
||||
return voltage;
|
||||
}
|
||||
|
||||
bool batt_sufficient() {
|
||||
uint16_t volts = read_voltage();
|
||||
return (( volts < 1000 ) || (volts > OTA_MIN_BATT)); // no battery or battery sufficient
|
||||
}
|
||||
|
||||
#endif // HAS_BATTERY_PROBE
|
@ -9,5 +9,6 @@
|
||||
|
||||
uint16_t read_voltage(void);
|
||||
void calibrate_voltage(void);
|
||||
bool batt_sufficient(void);
|
||||
|
||||
#endif
|
||||
|
@ -3,9 +3,7 @@
|
||||
#define HAS_LORA 1 // comment out if device shall not send data via LoRa
|
||||
#define HAS_SPI 1 // comment out if device shall not send data via SPI
|
||||
#define CFG_sx1272_radio 1
|
||||
//#define HAS_LED NOT_A_PIN // LoPy4 has no on board mono LED, we use on board RGB LED
|
||||
#define HAS_LED GPIO_NUM_12 // use if LoPy is on Expansion Board, this has a user LED
|
||||
#define LED_ACTIVE_LOW 1 // use if LoPy is on Expansion Board, this has a user LED
|
||||
#define HAS_LED NOT_A_PIN // LoPy4 has no on board mono LED, we use on board RGB LED
|
||||
#define HAS_RGB_LED GPIO_NUM_0 // WS2812B RGB LED on GPIO0
|
||||
|
||||
// Hardware pin definitions for Pycom LoPy board
|
||||
@ -22,19 +20,16 @@
|
||||
#define HAS_ANTENNA_SWITCH 16 // pin for switching wifi antenna
|
||||
#define WIFI_ANTENNA 0 // 0 = internal, 1 = external
|
||||
|
||||
// uncomment this only if your LoPy runs on a Pytrack expansion board with GPS
|
||||
#define HAS_GPS 1
|
||||
#define GPS_QUECTEL_L76 GPIO_NUM_25, GPIO_NUM_26 // SDA (P22), SCL (P21)
|
||||
#define GPS_ADDR 0x10
|
||||
// uncomment this only if your LoPy runs on a PYTRACK BOARD
|
||||
//#define HAS_GPS 1
|
||||
//#define GPS_QUECTEL_L76 GPIO_NUM_25, GPIO_NUM_26 // SDA (P22), SCL (P21)
|
||||
//#define GPS_ADDR 0x10
|
||||
|
||||
// uncomment this only if your LoPy runs on a expansion board 3.0
|
||||
// uncomment this only if your LoPy runs on a EXPANSION BOARD
|
||||
//#define HAS_LED GPIO_NUM_12 // use if LoPy is on Expansion Board, this has a user LED
|
||||
//#define LED_ACTIVE_LOW 1 // use if LoPy is on Expansion Board, this has a user LED
|
||||
//#define HAS_BUTTON GPIO_NUM_13 // user button on expansion board
|
||||
//define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown
|
||||
//#define HAS_BATTERY_PROBE ADC1_GPIO39_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7
|
||||
//#define BATT_FACTOR 2 // voltage divider 1MOhm/1MOhm on board
|
||||
//#define HAS_BUTTON GPIO_NUM_13 // (P14)
|
||||
//#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown
|
||||
|
||||
// uncomment this only if your LoPy runs on a expansion board 2.0
|
||||
//#define HAS_BATTERY_PROBE ADC1_GPIO39_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7
|
||||
//#define BATT_FACTOR 4 // voltage divider 115kOhm/56kOhm on board
|
||||
//#define HAS_BUTTON GPIO_NUM_13 // (P10)
|
||||
//#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown
|
||||
//#define BATT_FACTOR 2 // voltage divider 1MOhm/1MOhm -> expansion board 3.0
|
||||
//#define BATT_FACTOR 4 // voltage divider 115kOhm/56kOhm -> expansion board 2.0
|
||||
|
@ -1,11 +1,9 @@
|
||||
// Hardware related definitions for Pycom LoPy Board (not: LoPy4)
|
||||
// Hardware related definitions for Pycom LoPy4 Board
|
||||
|
||||
#define HAS_LORA 1 // comment out if device shall not send data via LoRa
|
||||
#define HAS_SPI 1 // comment out if device shall not send data via SPI
|
||||
#define CFG_sx1276_radio 1
|
||||
//#define HAS_LED NOT_A_PIN // LoPy4 has no on board mono LED, we use on board RGB LED
|
||||
#define HAS_LED GPIO_NUM_12 // use if LoPy is on Expansion Board, this has a user LED
|
||||
#define LED_ACTIVE_LOW 1 // use if LoPy is on Expansion Board, this has a user LED
|
||||
#define HAS_LED NOT_A_PIN // LoPy4 has no on board mono LED, we use on board RGB LED
|
||||
#define HAS_RGB_LED GPIO_NUM_0 // WS2812B RGB LED on GPIO0
|
||||
#define BOARD_HAS_PSRAM // use extra 4MB extern RAM
|
||||
|
||||
@ -23,19 +21,16 @@
|
||||
#define HAS_ANTENNA_SWITCH 21 // pin for switching wifi antenna
|
||||
#define WIFI_ANTENNA 0 // 0 = internal, 1 = external
|
||||
|
||||
// uncomment this only if your LoPy runs on a Pytrack expansion board with GPS
|
||||
// uncomment this only if your LoPy runs on a PYTRACK BOARD
|
||||
//#define HAS_GPS 1
|
||||
//#define GPS_QUECTEL_L76 GPIO_NUM_25, GPIO_NUM_26 // SDA (P22), SCL (P21)
|
||||
//#define GPS_ADDR 0x10
|
||||
|
||||
// uncomment this only if your LoPy runs on a expansion board 3.0
|
||||
#define HAS_BATTERY_PROBE ADC1_GPIO39_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7
|
||||
#define BATT_FACTOR 2 // voltage divider 1MOhm/1MOhm on board
|
||||
#define HAS_BUTTON GPIO_NUM_13 // (P14)
|
||||
#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown
|
||||
|
||||
// uncomment this only if your LoPy runs on a expansion board 2.0
|
||||
// uncomment this only if your LoPy runs on a EXPANSION BOARD
|
||||
//#define HAS_LED GPIO_NUM_12 // use if LoPy is on Expansion Board, this has a user LED
|
||||
//#define LED_ACTIVE_LOW 1 // use if LoPy is on Expansion Board, this has a user LED
|
||||
//#define HAS_BUTTON GPIO_NUM_13 // user button on expansion board
|
||||
//define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown
|
||||
//#define HAS_BATTERY_PROBE ADC1_GPIO39_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7
|
||||
//#define BATT_FACTOR 4 // voltage divider 115kOhm/56kOhm on board
|
||||
//#define HAS_BUTTON GPIO_NUM_13 // (P10)
|
||||
//#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown
|
||||
//#define BATT_FACTOR 2 // voltage divider 1MOhm/1MOhm -> expansion board 3.0
|
||||
//#define BATT_FACTOR 4 // voltage divider 115kOhm/56kOhm -> expansion board 2.0
|
@ -45,8 +45,8 @@ void gen_lora_deveui(uint8_t *pdeveui) {
|
||||
*p++ = dmac[5];
|
||||
*p++ = dmac[4];
|
||||
*p++ = dmac[3];
|
||||
*p++ = 0xff;
|
||||
*p++ = 0xfe;
|
||||
*p++ = 0xff;
|
||||
*p++ = dmac[2];
|
||||
*p++ = dmac[1];
|
||||
*p++ = dmac[0];
|
||||
@ -247,9 +247,7 @@ void lorawan_loop(void *pvParameters) {
|
||||
configASSERT(((uint32_t)pvParameters) == 1); // FreeRTOS check
|
||||
|
||||
while (1) {
|
||||
//vTaskSuspendAll();
|
||||
os_runloop_once(); // execute LMIC jobs
|
||||
//xTaskResumeAll();
|
||||
vTaskDelay(2 / portTICK_PERIOD_MS); // yield to CPU
|
||||
}
|
||||
}
|
||||
|
@ -43,13 +43,15 @@ inline String getHeaderValue(String header, String headerName) {
|
||||
|
||||
void start_ota_update() {
|
||||
|
||||
/*
|
||||
// check battery status if we can before doing ota
|
||||
#ifdef HAS_BATTERY_PROBE
|
||||
if (batt_voltage < OTA_MIN_BATT) {
|
||||
if (!batt_sufficient()) {
|
||||
ESP_LOGW(TAG, "Battery voltage %dmV too low for OTA", batt_voltage);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
// turn on LED
|
||||
#if (HAS_LED != NOT_A_PIN)
|
||||
|
Loading…
Reference in New Issue
Block a user