Merge pull request #173 from bobbycar-graz/update_submodules

Update submodules
This commit is contained in:
2021-12-24 01:39:25 +01:00
committed by GitHub
10 changed files with 123 additions and 114 deletions

View File

@ -18,8 +18,6 @@ jobs:
- name: Checkout (without submodules) - name: Checkout (without submodules)
uses: actions/checkout@v2 uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Checkout and install esp-idf - name: Checkout and install esp-idf
uses: 0xFEEDC0DE64/checkout_install_esp_idf@main uses: 0xFEEDC0DE64/checkout_install_esp_idf@main

View File

@ -1,10 +1,15 @@
#include "debuginputhandler.h" #include "debuginputhandler.h"
// Arduino includes // system includes
#include <HardwareSerial.h> #include <string_view>
// esp-idf includes
#include <driver/uart.h>
#include <esp_log.h>
// 3rdparty lib includes // 3rdparty lib includes
#include <tftinstance.h> #include <tftinstance.h>
#include <esp32-hal-gpio.h>
// local includes // local includes
#include "globals.h" #include "globals.h"
@ -12,117 +17,123 @@
#include "screens.h" #include "screens.h"
#include "buttons.h" #include "buttons.h"
using namespace espgui; namespace {
constexpr const char * const TAG = "DEBUG";
//wl_status_t last_status; uint8_t consoleControlCharsReceived{};
//IPAddress last_ip; bool uart0Initialized{};
} // namespace
void initDebugInput() void initDebugInput()
{ {
Serial.begin(115200); if (const auto result = uart_set_pin(UART_NUM_0, UART_PIN_NO_CHANGE, 3, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); result != ESP_OK)
//Serial.setDebugOutput(true); {
ESP_LOGE(TAG, "uart_set_pin() failed with %s", esp_err_to_name(result));
}
if (const auto result = uart_driver_install(UART_NUM_0, SOC_UART_FIFO_LEN + 1, 0, 10, nullptr, 0); result != ESP_OK)
ESP_LOGE(TAG, "uart_driver_install() failed with %s", esp_err_to_name(result));
else
uart0Initialized = true;
pinMode(3, INPUT_PULLUP); pinMode(3, INPUT_PULLUP);
} }
void handleDebugInput() void handleDebugInput()
{ {
//const auto status = WiFi.status(); if (!uart0Initialized)
//if (last_status != status) return;
//{
//Serial.print("Status changed to: ");
//Serial.println(to_string(status).c_str());
//last_status = status;
//}
//const auto ip = WiFi.localIP(); size_t length{};
//if (last_ip != ip) if (const auto result = uart_get_buffered_data_len(UART_NUM_0, &length); result != ESP_OK)
//{
//Serial.print("IP changed to: ");
//Serial.println(to_string(ip).c_str());
//last_ip = ip;
//}
while(Serial.available())
{ {
const auto c = Serial.read(); ESP_LOGW(TAG, "uart_get_buffered_data_len() failed with %s", esp_err_to_name(result));
}
else if (length)
{
char data[length];
length = uart_read_bytes(UART_NUM_0, data, length, 0);
switch (c) for (char c : std::string_view{data, length})
{ {
case 'i': switch (c)
case 'I': {
tft.init(); case 'i':
break; case 'I':
case 'p': espgui::tft.init();
case 'P': break;
{ case 'p':
const auto firstPower = controllers.front.command.poweroff; case 'P':
for (Controller &controller : controllers) {
controller.command.poweroff = !firstPower; const auto firstPower = controllers.front.command.poweroff;
break; for (Controller &controller : controllers)
} controller.command.poweroff = !firstPower;
case 'l': break;
case 'L': }
{ case 'l':
const auto firstLed = controllers.front.command.led; case 'L':
for (Controller &controller : controllers) {
controller.command.led = !firstLed; const auto firstLed = controllers.front.command.led;
break; for (Controller &controller : controllers)
} controller.command.led = !firstLed;
case 'r': break;
case 'R': }
loadSettings(); case 'r':
break; case 'R':
case 's': loadSettings();
case 'S': break;
saveSettings(); case 's':
break; case 'S':
case '0': saveSettings();
case '1': break;
case '2': case '0':
case '3': case '1':
case '4': case '2':
case '5': case '3':
case '6': case '4':
case '7': case '5':
case '8': case '6':
case '9': case '7':
for (Controller &controller : controllers) case '8':
controller.command.buzzer.freq = c-'0'; case '9':
break; for (Controller &controller : controllers)
case 'A': controller.command.buzzer.freq = c-'0';
InputDispatcher::rotate(-1); break;
break; case 'A':
case 'B': InputDispatcher::rotate(-1);
InputDispatcher::rotate(1); break;
break; case 'B':
case 'C': InputDispatcher::rotate(1);
InputDispatcher::confirmButton(true); break;
InputDispatcher::confirmButton(false); case 'C':
break; InputDispatcher::confirmButton(true);
case 'D': InputDispatcher::confirmButton(false);
InputDispatcher::backButton(true); break;
InputDispatcher::backButton(false); case 'D':
break; InputDispatcher::backButton(true);
case 'z': InputDispatcher::backButton(false);
case 'Z': break;
case 'z':
case 'Z':
#ifndef LEDSTRIP_WRONG_DIRECTION #ifndef LEDSTRIP_WRONG_DIRECTION
InputDispatcher::blinkLeftButton(true); InputDispatcher::blinkLeftButton(true);
InputDispatcher::blinkLeftButton(false); InputDispatcher::blinkLeftButton(false);
#else #else
InputDispatcher::blinkRightButton(true); InputDispatcher::blinkRightButton(true);
InputDispatcher::blinkRightButton(false); InputDispatcher::blinkRightButton(false);
#endif #endif
break; break;
case 'u': case 'u':
case 'U': case 'U':
#ifndef LEDSTRIP_WRONG_DIRECTION #ifndef LEDSTRIP_WRONG_DIRECTION
InputDispatcher::blinkRightButton(true); InputDispatcher::blinkRightButton(true);
InputDispatcher::blinkRightButton(false); InputDispatcher::blinkRightButton(false);
#else #else
InputDispatcher::blinkLeftButton(true); InputDispatcher::blinkLeftButton(true);
InputDispatcher::blinkLeftButton(false); InputDispatcher::blinkLeftButton(false);
#endif #endif
break; break;
}
} }
} }
} }

View File

@ -45,11 +45,11 @@ void AlertDisplay::initOverlay()
//espgui::tft.fillRect(leftMargin + 1, topMargin + 1, espgui::tft.width() - leftMargin - rightMargin - 2, espgui::tft.height() - topMargin - bottomMargin - 2, TFT_BLACK); //espgui::tft.fillRect(leftMargin + 1, topMargin + 1, espgui::tft.width() - leftMargin - rightMargin - 2, espgui::tft.height() - topMargin - bottomMargin - 2, TFT_BLACK);
espgui::tft.drawSunkenRect(leftMargin, topMargin, width, height, espgui::tft.drawSunkenRect(leftMargin, topMargin, width, height,
espgui::tft.color565(240, 240, 240), color565(240, 240, 240),
espgui::tft.color565(100, 100, 100), color565(100, 100, 100),
espgui::tft.color565(30, 30, 30)); color565(30, 30, 30));
espgui::tft.setTextColor(TFT_WHITE, espgui::tft.color565(30, 30, 30)); espgui::tft.setTextColor(TFT_WHITE, color565(30, 30, 30));
int x = leftMargin + 5; int x = leftMargin + 5;
int y = topMargin + 5; int y = topMargin + 5;
@ -71,23 +71,23 @@ void AlertDisplay::initOverlay()
break; break;
} }
espgui::tft.setTextColor(TFT_BLACK, espgui::tft.color565(170, 170, 170)); espgui::tft.setTextColor(TFT_BLACK, color565(170, 170, 170));
espgui::tft.drawSunkenRect(leftMargin + 15, bottom - 40, espgui::tft.drawSunkenRect(leftMargin + 15, bottom - 40,
(width - 15 - 10 - 15) / 2, (width - 15 - 10 - 15) / 2,
30, 30,
espgui::tft.color565(240, 240, 240), color565(240, 240, 240),
espgui::tft.color565(100, 100, 100), color565(100, 100, 100),
espgui::tft.color565(170, 170, 170)); color565(170, 170, 170));
espgui::tft.drawString("Yes", leftMargin + 18, bottom - 37); espgui::tft.drawString("Yes", leftMargin + 18, bottom - 37);
espgui::tft.drawSunkenRect(leftMargin + 15 + ((width - 15 - 30 - 15) / 2) + 15, bottom - 40, espgui::tft.drawSunkenRect(leftMargin + 15 + ((width - 15 - 30 - 15) / 2) + 15, bottom - 40,
(width - 15 - 10 - 15) / 2, (width - 15 - 10 - 15) / 2,
30, 30,
espgui::tft.color565(240, 240, 240), color565(240, 240, 240),
espgui::tft.color565(100, 100, 100), color565(100, 100, 100),
espgui::tft.color565(170, 170, 170)); color565(170, 170, 170));
espgui::tft.drawString("No", leftMargin + 18 + ((width - 15 - 30 - 15) / 2) + 15 + 1, bottom - 37); espgui::tft.drawString("No", leftMargin + 18 + ((width - 15 - 30 - 15) / 2) + 15 + 1, bottom - 37);
} }

View File

@ -69,7 +69,7 @@ void StarfieldDisplay::redraw()
{ {
uint8_t r, g, b; uint8_t r, g, b;
r = g = b = 255 - sz[i]; r = g = b = 255 - sz[i];
espgui::tft.drawPixel(screen_x, screen_y, espgui::tft.color565(r,g,b)); espgui::tft.drawPixel(screen_x, screen_y, color565(r,g,b));
} }
else else
sz[i] = 0; // Out of screen, die. sz[i] = 0; // Out of screen, die.