Merge pull request #167 from cyberman54/development

v1.5.8
This commit is contained in:
Verkehrsrot 2018-09-30 12:03:32 +02:00 committed by GitHub
commit e8f247b288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 35 additions and 38 deletions

View File

@ -907,7 +907,7 @@ static ostime_t nextJoinState (void) {
} else { } else {
LMIC.txChnl = os_getRndU1() & 0x3F; LMIC.txChnl = os_getRndU1() & 0x3F;
s1_t dr = DR_SF7 - ++LMIC.txCnt; s1_t dr = DR_SF7 - ++LMIC.txCnt;
if( dr < DR_SF10 ) { if( LMIC.txCnt > DR_SF7 ) {
dr = DR_SF10; dr = DR_SF10;
failed = 1; // All DR exhausted - signal failed failed = 1; // All DR exhausted - signal failed
} }

View File

@ -26,7 +26,7 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng
[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.5.7 release_version = 1.5.8
; 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 = 0 debug_level = 0

View File

@ -49,4 +49,9 @@ uint16_t read_voltage() {
return 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 #endif // HAS_BATTERY_PROBE

View File

@ -9,5 +9,6 @@
uint16_t read_voltage(void); uint16_t read_voltage(void);
void calibrate_voltage(void); void calibrate_voltage(void);
bool batt_sufficient(void);
#endif #endif

View File

@ -3,9 +3,7 @@
#define HAS_LORA 1 // comment out if device shall not send data via LoRa #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 HAS_SPI 1 // comment out if device shall not send data via SPI
#define CFG_sx1272_radio 1 #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 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_RGB_LED GPIO_NUM_0 // WS2812B RGB LED on GPIO0 #define HAS_RGB_LED GPIO_NUM_0 // WS2812B RGB LED on GPIO0
// Hardware pin definitions for Pycom LoPy board // Hardware pin definitions for Pycom LoPy board
@ -22,19 +20,16 @@
#define HAS_ANTENNA_SWITCH 16 // pin for switching wifi antenna #define HAS_ANTENNA_SWITCH 16 // pin for switching wifi antenna
#define WIFI_ANTENNA 0 // 0 = internal, 1 = external #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 HAS_GPS 1
#define GPS_QUECTEL_L76 GPIO_NUM_25, GPIO_NUM_26 // SDA (P22), SCL (P21) //#define GPS_QUECTEL_L76 GPIO_NUM_25, GPIO_NUM_26 // SDA (P22), SCL (P21)
#define GPS_ADDR 0x10 //#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 HAS_BATTERY_PROBE ADC1_GPIO39_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7
//#define BATT_FACTOR 2 // voltage divider 1MOhm/1MOhm on board //#define BATT_FACTOR 2 // voltage divider 1MOhm/1MOhm -> expansion board 3.0
//#define HAS_BUTTON GPIO_NUM_13 // (P14) //#define BATT_FACTOR 4 // voltage divider 115kOhm/56kOhm -> expansion board 2.0
//#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

View File

@ -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_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 HAS_SPI 1 // comment out if device shall not send data via SPI
#define CFG_sx1276_radio 1 #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 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_RGB_LED GPIO_NUM_0 // WS2812B RGB LED on GPIO0 #define HAS_RGB_LED GPIO_NUM_0 // WS2812B RGB LED on GPIO0
#define BOARD_HAS_PSRAM // use extra 4MB extern RAM #define BOARD_HAS_PSRAM // use extra 4MB extern RAM
@ -23,19 +21,16 @@
#define HAS_ANTENNA_SWITCH 21 // pin for switching wifi antenna #define HAS_ANTENNA_SWITCH 21 // pin for switching wifi antenna
#define WIFI_ANTENNA 0 // 0 = internal, 1 = external #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 HAS_GPS 1
//#define GPS_QUECTEL_L76 GPIO_NUM_25, GPIO_NUM_26 // SDA (P22), SCL (P21) //#define GPS_QUECTEL_L76 GPIO_NUM_25, GPIO_NUM_26 // SDA (P22), SCL (P21)
//#define GPS_ADDR 0x10 //#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_BATTERY_PROBE ADC1_GPIO39_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7 //#define HAS_LED GPIO_NUM_12 // use if LoPy is on Expansion Board, this has a user LED
#define BATT_FACTOR 2 // voltage divider 1MOhm/1MOhm on board //#define LED_ACTIVE_LOW 1 // use if LoPy is on Expansion Board, this has a user LED
#define HAS_BUTTON GPIO_NUM_13 // (P14) //#define HAS_BUTTON GPIO_NUM_13 // user button on expansion board
#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown //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 HAS_BATTERY_PROBE ADC1_GPIO39_CHANNEL // battery probe GPIO pin -> ADC1_CHANNEL_7
//#define BATT_FACTOR 4 // voltage divider 115kOhm/56kOhm on board //#define BATT_FACTOR 2 // voltage divider 1MOhm/1MOhm -> expansion board 3.0
//#define HAS_BUTTON GPIO_NUM_13 // (P10) //#define BATT_FACTOR 4 // voltage divider 115kOhm/56kOhm -> expansion board 2.0
//#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown

View File

@ -45,8 +45,8 @@ void gen_lora_deveui(uint8_t *pdeveui) {
*p++ = dmac[5]; *p++ = dmac[5];
*p++ = dmac[4]; *p++ = dmac[4];
*p++ = dmac[3]; *p++ = dmac[3];
*p++ = 0xff;
*p++ = 0xfe; *p++ = 0xfe;
*p++ = 0xff;
*p++ = dmac[2]; *p++ = dmac[2];
*p++ = dmac[1]; *p++ = dmac[1];
*p++ = dmac[0]; *p++ = dmac[0];
@ -247,9 +247,7 @@ void lorawan_loop(void *pvParameters) {
configASSERT(((uint32_t)pvParameters) == 1); // FreeRTOS check configASSERT(((uint32_t)pvParameters) == 1); // FreeRTOS check
while (1) { while (1) {
//vTaskSuspendAll();
os_runloop_once(); // execute LMIC jobs os_runloop_once(); // execute LMIC jobs
//xTaskResumeAll();
vTaskDelay(2 / portTICK_PERIOD_MS); // yield to CPU vTaskDelay(2 / portTICK_PERIOD_MS); // yield to CPU
} }
} }

View File

@ -43,13 +43,15 @@ inline String getHeaderValue(String header, String headerName) {
void start_ota_update() { void start_ota_update() {
/*
// check battery status if we can before doing ota // check battery status if we can before doing ota
#ifdef HAS_BATTERY_PROBE #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); ESP_LOGW(TAG, "Battery voltage %dmV too low for OTA", batt_voltage);
return; return;
} }
#endif #endif
*/
// turn on LED // turn on LED
#if (HAS_LED != NOT_A_PIN) #if (HAS_LED != NOT_A_PIN)

View File

@ -5,6 +5,7 @@
#include "globals.h" #include "globals.h"
#include "update.h" #include "update.h"
#include "battery.h"
#include <WiFi.h> #include <WiFi.h>
#include <WiFiClientSecure.h> #include <WiFiClientSecure.h>
#include <BintrayClient.h> #include <BintrayClient.h>