diff --git a/.gitignore b/.gitignore index d163863..c326afe 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -build/ \ No newline at end of file +build/ +serial_debugger*.bak +gui_backup/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1f5cc00 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + "files.associations": { + "xtemplate.h": "c", + "guislice_drv.h": "c", + "xradial.h": "c", + "*.tpp": "cpp", + "array": "cpp", + "deque": "cpp", + "string": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "string_view": "cpp", + "initializer_list": "cpp" + } +} \ No newline at end of file diff --git a/serial_debugger.ino b/serial_debugger.ino index 1ed617c..3e7a71b 100644 --- a/serial_debugger.ino +++ b/serial_debugger.ino @@ -1,3 +1,18 @@ +// +// FILE: [serial_debugger.ino] +// Created by GUIslice Builder version: [0.15.b004] +// +// GUIslice Builder Generated File +// +// For the latest guides, updates and support view: +// https://github.com/ImpulseAdventure/GUIslice +// +// + +// ------------------------------------------------ +// Headers to include +// ------------------------------------------------ +// // Varous system includes #include @@ -8,22 +23,29 @@ #include #include -// Debugging via serial monitor (don't turn this on unless you're hacking on the firmware code) -#define DEBUG true +// Various local includes +#include "serial_debugger_GSLC.h" + +// + +// ------------------------------------------------ +// Program Globals +// ------------------------------------------------ // Battery level measurement #define VBATPIN A6 float measuredVBat; -float batteryPercent; +int batteryPercent; // TFT Setup #define TFT_CS 9 #define TFT_DC 10 Adafruit_ILI9341 tft(TFT_CS, TFT_DC); #include -#define CHARS_HORIZONTAL 28 -#define CHARS_ROWS 13 -CircularBuffer textBuffer; +#define CHARS_HORIZONTAL 29 +#define CHARS_ROWS 11 +#define CHARS_TOTAL CHARS_HORIZONTAL * CHARS_ROWS +CircularBuffer textBuffer; // Keyboard BBQ10Keyboard keyboard; @@ -44,20 +66,48 @@ BBQ10Keyboard keyboard; Adafruit_NeoPixel pixels_board(PIXELS_NUM_BOARD, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel pixels_wing(PIXELS_NUM_WING, PIXELS_WING_PIN, NEO_GRB + NEO_KHZ800); +// GUI state globals +bool textChanged = false; + // Various loop handlers void handlerKeyboard(); void handlerBatteryLevel(); +void processRingBuffer(); -// UI screens -void screenClear(); +// Save some element references for direct access +// +gslc_tsElemRef* m_pElemBatteryLevel= NULL; +gslc_tsElemRef* m_pElemStatusText = NULL; +gslc_tsElemRef* m_pElemText = NULL; +// -// Color conversion (RGB888 -> RGB565 used by Adafruit GFX) -uint16_t RGB565(uint8_t r, uint8_t g, uint8_t b) { - return ((r & 0b11111000) << 8) | ((g & 0b11111100) << 3) | (b >> 3); -} +// Define debug message function +static int16_t DebugOut(char ch) { if (ch == (char)'\n') Serial.println(""); else Serial.write(ch); return 0; } + +// ------------------------------------------------ +// Callback Methods +// ------------------------------------------------ +//