fix display after merge of pr #313

This commit is contained in:
Verkehrsrot 2019-03-13 22:08:05 +01:00
parent 667107e3d7
commit 8f79011366
7 changed files with 16 additions and 14 deletions

View File

@ -131,7 +131,7 @@ extern time_t userUTCTime;
#include "lorawan.h" #include "lorawan.h"
#endif #endif
#if(HAS_DISPLAY) #ifdef HAS_DISPLAY
#include "display.h" #include "display.h"
#endif #endif

View File

@ -14,7 +14,7 @@
void irqHandler(void *pvParameters); void irqHandler(void *pvParameters);
#if(HAS_DISPLAY) #ifdef HAS_DISPLAY
#include "display.h" #include "display.h"
void IRAM_ATTR DisplayIRQ(); void IRAM_ATTR DisplayIRQ();
#endif #endif

View File

@ -18,7 +18,7 @@ void start_ota_update();
int version_compare(const String v1, const String v2); int version_compare(const String v1, const String v2);
void display(const uint8_t row, const std::string status, void display(const uint8_t row, const std::string status,
const std::string msg); const std::string msg);
#if(HAS_DISPLAY) #ifdef HAS_DISPLAY
void show_progress(unsigned long current, unsigned long size); void show_progress(unsigned long current, unsigned long size);
#endif #endif

View File

@ -1,4 +1,4 @@
#if(HAS_DISPLAY) #ifdef HAS_DISPLAY
/* /*

View File

@ -24,7 +24,7 @@ void irqHandler(void *pvParameters) {
#endif #endif
// display needs refresh? // display needs refresh?
#if(HAS_DISPLAY) #ifdef HAS_DISPLAY
if (InterruptStatus & DISPLAY_IRQ) if (InterruptStatus & DISPLAY_IRQ)
refreshtheDisplay(); refreshtheDisplay();
#endif #endif
@ -52,7 +52,7 @@ void irqHandler(void *pvParameters) {
// esp32 hardware timer triggered interrupt service routines // esp32 hardware timer triggered interrupt service routines
// they notify the irq handler task // they notify the irq handler task
#if(HAS_DISPLAY) #ifdef HAS_DISPLAY
void IRAM_ATTR DisplayIRQ() { void IRAM_ATTR DisplayIRQ() {
BaseType_t xHigherPriorityTaskWoken; BaseType_t xHigherPriorityTaskWoken;
xHigherPriorityTaskWoken = pdFALSE; xHigherPriorityTaskWoken = pdFALSE;

View File

@ -47,8 +47,10 @@ Tasks using i2c bus all must have same priority, because using mutex semaphore
// ESP32 hardware timers // ESP32 hardware timers
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
0 displayIRQ -> display refresh -> 40ms (DISPLAYREFRESH_MS in 0 displayIRQ -> display refresh -> 40ms (DISPLAYREFRESH_MS in paxcounter.conf)
paxcounter.conf) 1 ppsIRQ -> pps clock irq -> 1sec 2 unused 3 unused 1 ppsIRQ -> pps clock irq -> 1sec
2 unused
3 unused
// Interrupt routines // Interrupt routines
@ -306,7 +308,7 @@ void setup() {
#endif #endif
// initialize display // initialize display
#if(HAS_DISPLAY) #ifdef HAS_DISPLAY
strcat_P(features, " OLED"); strcat_P(features, " OLED");
DisplayState = cfg.screenon; DisplayState = cfg.screenon;
init_display(PRODUCTNAME, PROGVERSION); // note: blocking call init_display(PRODUCTNAME, PROGVERSION); // note: blocking call
@ -382,7 +384,7 @@ void setup() {
ESP_LOGI(TAG, "Starting Timers..."); ESP_LOGI(TAG, "Starting Timers...");
// display interrupt // display interrupt
#if(HAS_DISPLAY) #ifdef HAS_DISPLAY
// https://techtutorialsx.com/2017/10/07/esp32-arduino-timer-interrupts/ // https://techtutorialsx.com/2017/10/07/esp32-arduino-timer-interrupts/
// prescaler 80 -> divides 80 MHz CPU freq to 1 MHz, timer 0, count up // prescaler 80 -> divides 80 MHz CPU freq to 1 MHz, timer 0, count up
displayIRQ = timerBegin(0, 80, true); displayIRQ = timerBegin(0, 80, true);

View File

@ -48,7 +48,7 @@ void start_ota_update() {
switch_LED(LED_ON); switch_LED(LED_ON);
#if(HAS_DISPLAY) #ifdef HAS_DISPLAY
u8x8.begin(); u8x8.begin();
u8x8.setFont(u8x8_font_chroma48medium8_r); u8x8.setFont(u8x8_font_chroma48medium8_r);
u8x8.clear(); u8x8.clear();
@ -266,7 +266,7 @@ int do_ota_update() {
goto abort; goto abort;
} }
#if(HAS_DISPLAY) #ifdef HAS_DISPLAY
// register callback function for showing progress while streaming data // register callback function for showing progress while streaming data
Update.onProgress(&show_progress); Update.onProgress(&show_progress);
#endif #endif
@ -309,7 +309,7 @@ retry:
void display(const uint8_t row, const std::string status, void display(const uint8_t row, const std::string status,
const std::string msg) { const std::string msg) {
#if(HAS_DISPLAY) #ifdef HAS_DISPLAY
u8x8.setCursor(14, row); u8x8.setCursor(14, row);
u8x8.print((status.substr(0, 2)).c_str()); u8x8.print((status.substr(0, 2)).c_str());
if (!msg.empty()) { if (!msg.empty()) {
@ -320,7 +320,7 @@ void display(const uint8_t row, const std::string status,
#endif #endif
} }
#if(HAS_DISPLAY) #ifdef HAS_DISPLAY
// callback function to show download progress while streaming data // callback function to show download progress while streaming data
void show_progress(unsigned long current, unsigned long size) { void show_progress(unsigned long current, unsigned long size) {
char buf[17]; char buf[17];