From 57d0624fd03c6c454402c7a9fb6c2a82c8e4fb05 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Mon, 29 Jul 2019 10:26:58 +0200 Subject: [PATCH] removed GPS IRQ, since not really needed --- include/globals.h | 2 +- include/irqhandler.h | 4 ---- src/irqhandler.cpp | 17 ----------------- src/main.cpp | 13 +------------ src/rcommand.cpp | 1 + src/senddata.cpp | 1 + src/timekeeper.cpp | 2 +- 7 files changed, 5 insertions(+), 35 deletions(-) diff --git a/include/globals.h b/include/globals.h index 9e8549e5..20eb6934 100644 --- a/include/globals.h +++ b/include/globals.h @@ -112,7 +112,7 @@ extern uint16_t volatile macs_total, macs_wifi, macs_ble, batt_voltage; // display values extern bool volatile TimePulseTick; // 1sec pps flag set by GPS or RTC extern timesource_t timeSource; -extern hw_timer_t *displayIRQ, *matrixDisplayIRQ, *ppsIRQ, *gpsIRQ; +extern hw_timer_t *displayIRQ, *matrixDisplayIRQ, *ppsIRQ; extern SemaphoreHandle_t I2Caccess; extern TaskHandle_t irqHandlerTask, ClockTask; extern TimerHandle_t WifiChanTimer; diff --git a/include/irqhandler.h b/include/irqhandler.h index 3a06d3da..54b0e1a4 100644 --- a/include/irqhandler.h +++ b/include/irqhandler.h @@ -8,7 +8,6 @@ #define TIMESYNC_IRQ 0x010 #define MASK_IRQ 0x020 #define UNMASK_IRQ 0x040 -#define GPS_IRQ 0x080 #define MATRIX_DISPLAY_IRQ 0x100 #include "globals.h" @@ -32,8 +31,5 @@ void IRAM_ATTR MatrixDisplayIRQ(); void IRAM_ATTR ButtonIRQ(); #endif -#if (HAS_GPS) -void IRAM_ATTR GpsIRQ(); -#endif #endif \ No newline at end of file diff --git a/src/irqhandler.cpp b/src/irqhandler.cpp index 86177a31..6574bbcc 100644 --- a/src/irqhandler.cpp +++ b/src/irqhandler.cpp @@ -45,12 +45,6 @@ void irqHandler(void *pvParameters) { refreshTheMatrixDisplay(); #endif -// gps refresh buffer? -#if (HAS_GPS) - if (InterruptStatus & GPS_IRQ) - gps_storelocation(&gps_status); -#endif - // are cyclic tasks due? if (InterruptStatus & CYCLIC_IRQ) doHousekeeping(); @@ -108,17 +102,6 @@ void IRAM_ATTR ButtonIRQ() { } #endif -#if (HAS_GPS) -void IRAM_ATTR GpsIRQ() { - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - - xTaskNotifyFromISR(irqHandlerTask, GPS_IRQ, eSetBits, - &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken) - portYIELD_FROM_ISR(); -} -#endif - void mask_user_IRQ() { xTaskNotify(irqHandlerTask, MASK_IRQ, eSetBits); } void unmask_user_IRQ() { xTaskNotify(irqHandlerTask, UNMASK_IRQ, eSetBits); } \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index f97ca72d..34787246 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -48,7 +48,6 @@ So don't do it if you do not own a digital oscilloscope. ------------------------------------------------------------------------------- 0 displayIRQ -> display refresh -> 40ms (DISPLAYREFRESH_MS) 1 ppsIRQ -> pps clock irq -> 1sec -2 gpsIRQ -> gps store data -> 300ms 3 MatrixDisplayIRQ -> matrix mux cycle -> 0,5ms (MATRIX_DISPLAY_SCAN_US) @@ -58,7 +57,6 @@ So don't do it if you do not own a digital oscilloscope. fired by hardware DisplayIRQ -> esp32 timer 0 -> irqHandlerTask (Core 1) CLOCKIRQ -> esp32 timer 1 -> ClockTask (Core 1) -GpsIRQ -> esp32 timer 2 -> irqHandlerTask (Core 1) ButtonIRQ -> external gpio -> irqHandlerTask (Core 1) fired by software (Ticker.h) @@ -82,8 +80,7 @@ uint8_t volatile channel = 0; // channel rotation counter uint16_t volatile macs_total = 0, macs_wifi = 0, macs_ble = 0, batt_voltage = 0; // globals for display -hw_timer_t *ppsIRQ = NULL, *displayIRQ = NULL, *matrixDisplayIRQ = NULL, - *gpsIRQ = NULL; +hw_timer_t *ppsIRQ = NULL, *displayIRQ = NULL, *matrixDisplayIRQ = NULL; TaskHandle_t irqHandlerTask = NULL, ClockTask = NULL; SemaphoreHandle_t I2Caccess; @@ -419,14 +416,6 @@ void setup() { button_init(HAS_BUTTON); #endif // HAS_BUTTON - // gps buffer read interrupt -#if (HAS_GPS) - gpsIRQ = timerBegin(2, 80, true); - timerAttachInterrupt(gpsIRQ, &GpsIRQ, true); - timerAlarmWrite(gpsIRQ, 300 * 1000, true); - timerAlarmEnable(gpsIRQ); -#endif - // cyclic function interrupts sendcycler.attach(SENDCYCLE * 2, sendcycle); housekeeper.attach(HOMECYCLE, housekeeping); diff --git a/src/rcommand.cpp b/src/rcommand.cpp index 20f8cc36..e1cb37f4 100644 --- a/src/rcommand.cpp +++ b/src/rcommand.cpp @@ -253,6 +253,7 @@ void get_status(uint8_t val[]) { void get_gps(uint8_t val[]) { ESP_LOGI(TAG, "Remote command: get gps status"); #if(HAS_GPS) + gps_storelocation(&gps_status); payload.reset(); payload.addGPS(gps_status); SendPayload(GPSPORT, prio_high); diff --git a/src/senddata.cpp b/src/senddata.cpp index ecbfb0ec..8b95f219 100644 --- a/src/senddata.cpp +++ b/src/senddata.cpp @@ -87,6 +87,7 @@ void sendCounter() { case GPS_DATA: // send GPS position only if we have a fix if (gps.location.isValid()) { + gps_storelocation(&gps_status); payload.reset(); payload.addGPS(gps_status); SendPayload(GPSPORT, prio_high); diff --git a/src/timekeeper.cpp b/src/timekeeper.cpp index 7cd1bbe0..d80d0d3a 100644 --- a/src/timekeeper.cpp +++ b/src/timekeeper.cpp @@ -131,7 +131,7 @@ void IRAM_ATTR CLOCKIRQ(void) { SyncToPPS(); // advance systime, see microTime.h - // store recent gps time, and try to get gps time if time is not synced + // store recent gps time #if (HAS_GPS) gps_storetime(&gps_status); #endif