Ability to enable or disable pages on the u8g2 OLED display

pull/21/head
Farkas Szilárd 2020-07-04 16:04:05 +02:00
rodzic 5f3587a15a
commit 832f84d0be
2 zmienionych plików z 29 dodań i 24 usunięć

Wyświetl plik

@ -21,6 +21,8 @@
// #define WITH_OLED2 // 2nd OLED display, I2C address next higher
#define WITH_U8G2_OLED // I2C OLED through the U8g2 library
// #define WITH_U8G2_SH1106
#define U8G2_OLED_PAGES_ENABLED 0b0001111111 // use if WITH_U8G2_OLED is on, 10 pages currently, see end of disp.ccp for the list of pages
#define WITH_RFM95 // RF chip selection: both HELTEC and TTGO use sx1276 which is same as RFM95

Wyświetl plik

@ -25,12 +25,8 @@
#include "disp_lcd.h"
#ifdef WITH_U8G2_OLED
#ifdef WITH_U8G2_LISTS
const uint8_t DISP_Pages = 7+3;
#else
const uint8_t DISP_Pages = 7;
#endif
static uint8_t DISP_Page = 1;
const uint8_t DISP_Pages = 10;
static uint8_t DISP_Page = 0;
#endif
#if defined(WITH_ST7789) || defined(WITH_ILI9341)
const uint8_t DISP_Pages = 9;
@ -45,7 +41,7 @@ void vTaskDISP(void* pvParameters)
u8g2_ClearBuffer(&U8G2_OLED);
OLED_DrawLogo(&U8G2_OLED); // draw logo
u8g2_SendBuffer(&U8G2_OLED);
vTaskDelay(5000); // allow 5sec for the user to see the logo
vTaskDelay(2000); // allow 2sec for the user to see the logo
#endif
#if defined(WITH_ST7789) || defined(WITH_ILI9341)
// LCD_Start();
@ -169,24 +165,31 @@ void vTaskDISP(void* pvParameters)
// { OLED_DrawTrafWarn(&U8G2_OLED, GPS); }
// else
// #endif
{ switch(DISP_Page)
{ case 2: OLED_DrawGPS (&U8G2_OLED, GPS); break;
case 3: OLED_DrawRF (&U8G2_OLED, GPS); break;
case 4: OLED_DrawBaro (&U8G2_OLED, GPS); break;
case 1: OLED_DrawID (&U8G2_OLED, GPS); break;
case 5: OLED_DrawSystem(&U8G2_OLED, GPS); break;
// case 6: OLED_DrawRelay (&U8G2_OLED, GPS); break;
// case 7: OLED_DrawLookout(&U8G2_OLED, GPS); break;
case 0: OLED_DrawBattery(&U8G2_OLED, GPS); break;
case 6: OLED_DrawAltitudeAndSpeed (&U8G2_OLED, GPS); break;
#ifdef WITH_U8G2_LISTS
case 7: OLED_DrawRelay (&U8G2_OLED, GPS); break;
case 8: OLED_DrawLookout(&U8G2_OLED, GPS); break;
case 9: OLED_DrawTrafWarn(&U8G2_OLED, GPS); break;
// skip not enabled pages
while ( (U8G2_OLED_PAGES_ENABLED & (1 << DISP_Page)) == 0 ) {
DISP_Page++;
if(DISP_Page>=DISP_Pages) DISP_Page=0;
}
#ifdef DEBUG_PRINT
xSemaphoreTake(CONS_Mutex, portMAX_DELAY);
Format_String(CONS_UART_Write, "DISP_Page: ");
Format_Hex(CONS_UART_Write, DISP_Page);
Format_String(CONS_UART_Write, "\n");
xSemaphoreGive(CONS_Mutex);
#endif
// default:
// { OLED_DrawStatus(&U8G2_OLED, Time, 0);
// OLED_DrawPosition(&U8G2_OLED, GPS, 2); }
{ switch(DISP_Page)
{ case 0: OLED_DrawID (&U8G2_OLED, GPS); break;
case 1: OLED_DrawGPS (&U8G2_OLED, GPS); break;
case 2: OLED_DrawRF (&U8G2_OLED, GPS); break;
case 3: OLED_DrawBaro (&U8G2_OLED, GPS); break;
case 4: OLED_DrawSystem (&U8G2_OLED, GPS); break;
case 5: OLED_DrawBattery (&U8G2_OLED, GPS); break;
case 6: OLED_DrawAltitudeAndSpeed (&U8G2_OLED, GPS); break;
case 7: OLED_DrawRelay (&U8G2_OLED, GPS); break;
case 8: OLED_DrawLookout (&U8G2_OLED, GPS); break;
case 9: OLED_DrawTrafWarn (&U8G2_OLED, GPS); break;
}
}
//if ( DISP_Page != 6 )