Merge pull request #509 from cyberman54/development

Bugfixes
This commit is contained in:
Verkehrsrot 2019-12-26 13:28:59 +01:00 committed by GitHub
commit 33e92d0464
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 43 additions and 25 deletions

View File

@ -43,10 +43,10 @@ void showLoraKeys(void);
void lora_send(void *pvParameters);
void lora_enqueuedata(MessageBuffer_t *message);
void lora_queuereset(void);
static void IRAM_ATTR myEventCallback(void *pUserData, ev_t ev);
static void IRAM_ATTR myRxCallback(void *pUserData, uint8_t port,
void IRAM_ATTR myEventCallback(void *pUserData, ev_t ev);
void IRAM_ATTR myRxCallback(void *pUserData, uint8_t port,
const uint8_t *pMsg, size_t nMsg);
static 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[],
const uint8_t tablesize);
uint8_t getBattLevel(void);

View File

@ -17,7 +17,7 @@ void start_ota_update();
int version_compare(const String v1, const String v2);
void ota_display(const uint8_t row, const std::string status,
const std::string msg);
static void show_progress(unsigned long current, unsigned long size);
void show_progress(unsigned long current, unsigned long size);
#endif // USE_OTA

View File

@ -9,7 +9,7 @@
void wifi_sniffer_init(void);
void switch_wifi_sniffer (uint8_t state);
static void IRAM_ATTR wifi_sniffer_packet_handler(void *buff, wifi_promiscuous_pkt_type_t type);
void IRAM_ATTR wifi_sniffer_packet_handler(void *buff, wifi_promiscuous_pkt_type_t type);
void switchWifiChannel(TimerHandle_t xTimer);
#endif

View File

@ -22,11 +22,11 @@ void doHousekeeping() {
// check if update mode trigger switch was set
if (RTC_runmode == RUNMODE_UPDATE) {
// check battery status if we can before doing ota
if (batt_sufficient())
if (batt_sufficient()) {
do_reset(true); // warmstart to runmode update
else {
} else {
ESP_LOGE(TAG, "Battery voltage %dmV too low for OTA", batt_voltage);
RTC_runmode == RUNMODE_NORMAL; // keep running in normal mode
RTC_runmode = RUNMODE_NORMAL; // keep running in normal mode
}
}
@ -82,8 +82,8 @@ void doHousekeeping() {
ESP_LOGI(TAG, "BME280 Temp: %.2f°C | Humidity: %.2f | Pressure: %.0f",
bme_status.temperature, bme_status.humidity, bme_status.pressure);
#elif defined HAS_BMP180
ESP_LOGI(TAG, "BMP180 Temp: %.2f°C | Pressure: %.0f",
bme_status.temperature, bme_status.pressure);
ESP_LOGI(TAG, "BMP180 Temp: %.2f°C | Pressure: %.0f", bme_status.temperature,
bme_status.pressure);
#endif
#endif

View File

@ -8,7 +8,7 @@ void irqHandler(void *pvParameters) {
configASSERT(((uint32_t)pvParameters) == 1); // FreeRTOS check
uint32_t InterruptStatus;
static uint32_t InterruptStatus = 0x00;
static bool mask_irq = false;
// task remains in blocked state until it is notified by an irq
@ -37,49 +37,65 @@ void irqHandler(void *pvParameters) {
// button pressed?
#ifdef HAS_BUTTON
if (InterruptStatus & BUTTON_IRQ)
if (InterruptStatus & BUTTON_IRQ) {
readButton();
InterruptStatus &= ~BUTTON_IRQ;
}
#endif
// display needs refresh?
#ifdef HAS_DISPLAY
if (InterruptStatus & DISPLAY_IRQ)
if (InterruptStatus & DISPLAY_IRQ) {
refreshTheDisplay();
InterruptStatus &= ~DISPLAY_IRQ;
}
#endif
// LED Matrix display needs refresh?
#ifdef HAS_MATRIX_DISPLAY
if (InterruptStatus & MATRIX_DISPLAY_IRQ)
if (InterruptStatus & MATRIX_DISPLAY_IRQ) {
refreshTheMatrixDisplay();
InterruptStatus &= ~MATRIX_DISPLAY_IRQ;
}
#endif
// BME sensor data to be read?
#if (HAS_BME)
if (InterruptStatus & BME_IRQ)
if (InterruptStatus & BME_IRQ) {
bme_storedata(&bme_status);
InterruptStatus &= ~BME_IRQ;
}
#endif
// are cyclic tasks due?
if (InterruptStatus & CYCLIC_IRQ)
if (InterruptStatus & CYCLIC_IRQ) {
doHousekeeping();
InterruptStatus &= ~CYCLIC_IRQ;
}
#if (TIME_SYNC_INTERVAL)
// is time to be synced?
if (InterruptStatus & TIMESYNC_IRQ) {
now(); // ensure sysTime is recent
calibrateTime();
InterruptStatus &= ~TIMESYNC_IRQ;
}
#endif
// do we have a power event?
#if (HAS_PMU)
if (InterruptStatus & PMU_IRQ)
if (InterruptStatus & PMU_IRQ) {
AXP192_powerevent_IRQ();
InterruptStatus &= ~PMU_IRQ;
}
#endif
// is time to send the payload?
if (InterruptStatus & SENDCYCLE_IRQ)
if (InterruptStatus & SENDCYCLE_IRQ) {
sendData();
InterruptStatus &= ~SENDCYCLE_IRQ;
}
}
}

View File

@ -452,7 +452,7 @@ void lmictask(void *pvParameters) {
} // lmictask
// lmic event handler
static void myEventCallback(void *pUserData, ev_t ev) {
void myEventCallback(void *pUserData, ev_t ev) {
// using message descriptors from LMIC library
static const char *const evNames[] = {LMIC_EVENT_NAME_TABLE__INIT};
@ -502,7 +502,7 @@ static void myEventCallback(void *pUserData, ev_t ev) {
}
// receive message handler
static 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) {
// display type of received data
@ -557,7 +557,7 @@ static void myRxCallback(void *pUserData, uint8_t port, const uint8_t *pMsg,
}
// transmit complete message handler
static void myTxCallback(void *pUserData, int fSuccess) {
void myTxCallback(void *pUserData, int fSuccess) {
#if (TIME_SYNC_LORASERVER)
// if last packet sent was a timesync request, store TX timestamp

View File

@ -318,7 +318,7 @@ void ota_display(const uint8_t row, const std::string status,
}
// callback function to show download progress while streaming data
static void show_progress(unsigned long current, unsigned long size) {
void show_progress(unsigned long current, unsigned long size) {
#ifdef HAS_DISPLAY
char buf[17];
snprintf(buf, 17, "%-9lu (%3lu%%)", current, current * 100 / size);

View File

@ -58,7 +58,9 @@ void sendData() {
uint8_t bitmask = cfg.payloadmask;
uint8_t mask = 1;
#if (HAS_GPS)
gpsStatus_t gps_status;
#endif
while (bitmask) {
switch (bitmask & mask) {

View File

@ -29,8 +29,8 @@ typedef struct {
} wifi_ieee80211_packet_t;
// using IRAM_:ATTR here to speed up callback function
static IRAM_ATTR void
wifi_sniffer_packet_handler(void *buff, wifi_promiscuous_pkt_type_t type) {
IRAM_ATTR void wifi_sniffer_packet_handler(void *buff,
wifi_promiscuous_pkt_type_t type) {
const wifi_promiscuous_pkt_t *ppkt = (wifi_promiscuous_pkt_t *)buff;
const wifi_ieee80211_packet_t *ipkt =
@ -75,7 +75,7 @@ void wifi_sniffer_init(void) {
ESP_ERROR_CHECK(esp_wifi_set_ps(WIFI_PS_NONE)); // no modem power saving
ESP_ERROR_CHECK(esp_wifi_set_promiscuous_filter(&filter)); // set frame filter
ESP_ERROR_CHECK(esp_wifi_set_promiscuous_rx_cb(&wifi_sniffer_packet_handler));
ESP_ERROR_CHECK(esp_wifi_start()); //for esp_wifi v3.3
ESP_ERROR_CHECK(esp_wifi_start()); // for esp_wifi v3.3
ESP_ERROR_CHECK(esp_wifi_set_promiscuous(true)); // now switch on monitor mode
// setup wifi channel rotation timer