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,45 +17,50 @@
#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);
for (char c : std::string_view{data, length})
{
switch (c) switch (c)
{ {
case 'i': case 'i':
case 'I': case 'I':
tft.init(); espgui::tft.init();
break; break;
case 'p': case 'p':
case 'P': case 'P':
@ -126,3 +136,4 @@ void handleDebugInput()
} }
} }
} }
}

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.