From 9d71c9b05503b3332c9d758a05e9ab90e814480e Mon Sep 17 00:00:00 2001 From: Elizabeth Cray Date: Thu, 11 Sep 2025 23:54:28 -0400 Subject: [PATCH] Attempting to buffer --- Crash.log | 124 +++++++++++++++++++++++++++++++++++++++++ platformio.ini | 5 +- src/gauge_airspeed.cpp | 28 +++++++++- src/gauge_airspeed.h | 3 +- src/main.cpp | 25 +++++++-- 5 files changed, 175 insertions(+), 10 deletions(-) create mode 100644 Crash.log diff --git a/Crash.log b/Crash.log new file mode 100644 index 0000000..caa2c7a --- /dev/null +++ b/Crash.log @@ -0,0 +1,124 @@ +--- Terminal on /dev/ttyACM1 | 115200 8-N-1 +--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time +--- More details at https://bit.ly/pio-monitor-filters +--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H +Serial initialized +Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled. + +Core 1 register dump: +PC : 0x40109528 PS : 0x00060a30 A0 : 0x80109180 A1 : 0x3ffb2180 +A2 : 0x3ffb7e3c A3 : 0x00000000 A4 : 0x00000000 A5 : 0x000000f0 +A6 : 0x000000f0 A7 : 0x00002104 A8 : 0x00000000 A9 : 0x00000000 +A10 : 0x000000f0 A11 : 0x003fffff A12 : 0x80083c8a A13 : 0x3ffbcdc0 +A14 : 0x00000001 A15 : 0x3ffb0320 SAR : 0x00000013 EXCCAUSE: 0x0000001d +EXCVADDR: 0x00000000 LBEG : 0x4008665d LEND : 0x4008666d LCOUNT : 0xfffffffb + + +Backtrace: 0x40109525:0x3ffb2180 0x4010917d:0x3ffb21a0 0x400d417b:0x3ffb21c0 0x400d41a1:0x3ffb21e0 0x400d2426:0x3ffb2200 0x400d2876:0x3ffb2250 0x400dac91:0x3ffb2290 + + + + +ELF file SHA256: 5a0a0b661c61d07f + +Rebooting... +ets Jul 29 2019 12:21:46 + +rst:0xc (SW_CPU_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT) +configsip: 0, SPIWP:0xee +clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 +mode:DIO, clock div:2 +load:0x3fff0030,len:1184 +load:0x40078000,len:13232 +load:0x40080400,len:3028 +entry 0x400805e4 +Serial initialized +Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled. + +Core 1 register dump: +PC : 0x40109528 PS : 0x00060a30 A0 : 0x80109180 A1 : 0x3ffb2180 +A2 : 0x3ffb7e3c A3 : 0x00000000 A4 : 0x00000000 A5 : 0x000000f0 +A6 : 0x000000f0 A7 : 0x00002104 A8 : 0x00000000 A9 : 0x00000000 +A10 : 0x000000f0 A11 : 0x003fffff A12 : 0x80083c8a A13 : 0x3ffbcdc0 +A14 : 0x00000001 A15 : 0x3ffb0320 SAR : 0x00000013 EXCCAUSE: 0x0000001d +EXCVADDR: 0x00000000 LBEG : 0x4008665d LEND : 0x4008666d LCOUNT : 0xfffffffb + + +Backtrace: 0x40109525:0x3ffb2180 0x4010917d:0x3ffb21a0 0x400d417b:0x3ffb21c0 0x400d41a1:0x3ffb21e0 0x400d2426:0x3ffb2200 0x400d2876:0x3ffb2250 0x400dac91:0x3ffb2290 + + + + +ELF file SHA256: 5a0a0b661c61d07f + +Rebooting... +ets Jul 29 2019 12:21:46 + +rst:0xc (SW_CPU_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT) +configsip: 0, SPIWP:0xee +clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 +mode:DIO, clock div:2 +load:0x3fff0030,len:1184 +load:0x40078000,len:13232 +load:0x40080400,len:3028 +entry 0x400805e4 +Serial initialized +Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled. + +Core 1 register dump: +PC : 0x40109528 PS : 0x00060a30 A0 : 0x80109180 A1 : 0x3ffb2180 +A2 : 0x3ffb7e3c A3 : 0x00000000 A4 : 0x00000000 A5 : 0x000000f0 +A6 : 0x000000f0 A7 : 0x00002104 A8 : 0x00000000 A9 : 0x00000000 +A10 : 0x000000f0 A11 : 0x003fffff A12 : 0x80083c8a A13 : 0x3ffbcdc0 +A14 : 0x00000001 A15 : 0x3ffb0320 SAR : 0x00000013 EXCCAUSE: 0x0000001d +EXCVADDR: 0x00000000 LBEG : 0x4008665d LEND : 0x4008666d LCOUNT : 0xfffffffb + + +Backtrace: 0x40109525:0x3ffb2180 0x4010917d:0x3ffb21a0 0x400d417b:0x3ffb21c0 0x400d41a1:0x3ffb21e0 0x400d2426:0x3ffb2200 0x400d2876:0x3ffb2250 0x400dac91:0x3ffb2290 + + + + +ELF file SHA256: 5a0a0b661c61d07f + +Rebooting... +ets Jul 29 2019 12:21:46 + +rst:0xc (SW_CPU_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT) +configsip: 0, SPIWP:0xee +clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 +mode:DIO, clock div:2 +load:0x3fff0030,len:1184 +load:0x40078000,len:13232 +load:0x40080400,len:3028 +entry 0x400805e4 +Serial initialized +Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled. + +Core 1 register dump: +PC : 0x40109528 PS : 0x00060a30 A0 : 0x80109180 A1 : 0x3ffb2180 +A2 : 0x3ffb7e3c A3 : 0x00000000 A4 : 0x00000000 A5 : 0x000000f0 +A6 : 0x000000f0 A7 : 0x00002104 A8 : 0x00000000 A9 : 0x00000000 +A10 : 0x000000f0 A11 : 0x003fffff A12 : 0x80083c8a A13 : 0x3ffbcdc0 +A14 : 0x00000001 A15 : 0x3ffb0320 SAR : 0x00000013 EXCCAUSE: 0x0000001d +EXCVADDR: 0x00000000 LBEG : 0x4008665d LEND : 0x4008666d LCOUNT : 0xfffffffb + + +Backtrace: 0x40109525:0x3ffb2180 0x4010917d:0x3ffb21a0 0x400d417b:0x3ffb21c0 0x400d41a1:0x3ffb21e0 0x400d2426:0x3ffb2200 0x400d2876:0x3ffb2250 0x400dac91:0x3ffb2290 + + + + +ELF file SHA256: 5a0a0b661c61d07f + +Rebooting... +ets Jul 29 2019 12:21:46 + +rst:0xc (SW_CPU_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT) +configsip: 0, SPIWP:0xee +clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 +mode:DIO, clock div:2 +load:0x3fff0030,len:1184 +load:0x40078000,len:13232 +load:0x40080400,len:3028 +entry 0x400805e4 diff --git a/platformio.ini b/platformio.ini index 19ed262..5e8406c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,10 +12,11 @@ platform = espressif32 board = esp32dev framework = arduino -upload_port = /dev/ttyACM0 +upload_port = /dev/ttyACM1 monitor_speed = 115200 -monitor_port = /dev/ttyACM0 +monitor_port = /dev/ttyACM1 lib_deps = tzapu/WiFiManager@^2.0.17 robtillaart/FastTrig@^0.3.4 olikraus/U8g2@^2.36.12 + adafruit/Adafruit GFX Library@^1.12.1 diff --git a/src/gauge_airspeed.cpp b/src/gauge_airspeed.cpp index c0fc318..a1dc7cf 100644 --- a/src/gauge_airspeed.cpp +++ b/src/gauge_airspeed.cpp @@ -3,6 +3,7 @@ #include #include #include +// #include void Ticks(Arduino_GFX *gfx, uint8_t count, int16_t start_angle, int16_t end_angle, int color=RGB565_WHITE, bool enthicken=false, bool invert=false, uint16_t radius=95, uint16_t length=30) { for (uint8_t i = 0; i < count; i++) { @@ -20,7 +21,13 @@ void Ticks(Arduino_GFX *gfx, uint8_t count, int16_t start_angle, int16_t end_ang } } -void gauge(Arduino_GFX *gfx, int airspeed) { +void gauge(Arduino_Canvas *gfx) { + gfx->fillScreen(BACKGROUND); + // TAS + gfx->fillArc(120, 120, 89, 120, 49, 130, RGB565(181, 181, 179)); + gfx->fillArc(120, 120, 40, 120, -228, 49, BACKGROUND); + // TODO: insert true air speed adjusted rotating numbers here + // Main Dial gfx->fillArc(120, 120, 100, 90, -60, 36, RGB565_WHITE); gfx->fillArc(120, 120, 90, 80, -45, 130, RGB565(90, 170, 69)); gfx->fillArc(120, 120, 90, 80, 130, 181, RGB565_YELLOW); @@ -47,12 +54,27 @@ void gauge(Arduino_GFX *gfx, int airspeed) { gfx->setCursor(114+xa, 126+ya); gfx->print(buf); } + // Titles gfx->setFont(u8g2_font_t0_15b_me); gfx->setCursor(102, 142); gfx->print("KNOTS"); gfx->setCursor(90, 100); gfx->print("AIRSPEED"); - - gfx->fillCircle(120, 120, 6, RGB565_WHITE); + return; +} + +void needle(Arduino_Canvas *gfx, uint16_t airspeed) { + // Needle + const uint16_t needle_length = 100; + const uint8_t needle_width = 20; + int16_t angle = map(airspeed, GAUGE_AIRSPEED_MIN, GAUGE_AIRSPEED_MAX, -60, 182); + gfx->fillTriangle(icos(angle)*needle_length + 120, isin(angle)*needle_length + 120, + icos(angle-90)*(needle_width/2) + 120, isin(angle-90)*(needle_width/2) + 120, + icos(angle+90)*(needle_width/2) + 120, isin(angle+90)*(needle_width/2) + 120, + RGB565_RED); + gfx->fillTriangle(icos(angle-90)*(needle_width/2) + 120, isin(angle-90)*(needle_width/2) + 120, + icos(angle+90)*(needle_width/2) + 120, isin(angle+90)*(needle_width/2) + 120, + isin(angle-90)*((2*needle_width)/3) + 120, -icos(angle-90)*((2*needle_width)/3) + 120, + RGB565_RED); return; } diff --git a/src/gauge_airspeed.h b/src/gauge_airspeed.h index 62230ca..94d59c6 100644 --- a/src/gauge_airspeed.h +++ b/src/gauge_airspeed.h @@ -1,5 +1,6 @@ #ifdef GAUGE_AIRSPEED -void gauge(Arduino_GFX *gfx, int airspeed); +void gauge(Arduino_Canvas *gfx); +void needle(Arduino_Canvas *gfx, uint16_t airspeed); #endif diff --git a/src/main.cpp b/src/main.cpp index f89a130..87ee289 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,6 +2,7 @@ #include #include #include +// #include #include #include "ui.h" #include "config.h" @@ -9,6 +10,9 @@ Arduino_DataBus *bus = new Arduino_ESP32SPI(27, 5, 14, 15, -1, VSPI); Arduino_GFX *gfx = new Arduino_GC9A01(bus, 33, 0, true); +// Arduino_GFX *canvas = new Arduino_Canvas_Indexed(240, 240, gfx, 0, 0, 0, 2); +Arduino_Canvas *canvas = new Arduino_Canvas(240, 240, gfx); +// GFXcanvas16 canvas(240, 240); WiFiManager wifiManager; #define SW1 19 @@ -27,6 +31,7 @@ void registerWifi() { drawWifi(gfx); log("Create Access Point SSID\n"); log(AP_SSID); + // canvas->flush(true); wifiManager.autoConnect(AP_SSID); } @@ -44,12 +49,24 @@ void setup() { // registerWifi(); } +uint16_t asa = 0; void loop() { if (digitalRead(SW1) == LOW) { log("Button pressed\n"); } - gfx->fillScreen(BACKGROUND); - gauge(gfx, 50); - delay(10); - for(;;); + // gfx->fillScreen(BACKGROUND); + if(asa > 200) { + asa = 0; + } + delay(100); + gauge(canvas); + needle(canvas, asa); + log("Airspeed: "); + log(String(asa).c_str()); + log("\n"); + // gfx->draw16bitRGBBitmapWithMask(); + // gfx->draw16bitRGBBitmap(0, 0, (uint16_t *)canvas->getBuffer(), 240, 240); + canvas->flush(); + // delay(100); + asa += 5; }