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)
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
uses: 0xFEEDC0DE64/checkout_install_esp_idf@main

View File

@ -1,10 +1,15 @@
#include "debuginputhandler.h"
// Arduino includes
#include <HardwareSerial.h>
// system includes
#include <string_view>
// esp-idf includes
#include <driver/uart.h>
#include <esp_log.h>
// 3rdparty lib includes
#include <tftinstance.h>
#include <esp32-hal-gpio.h>
// local includes
#include "globals.h"
@ -12,45 +17,50 @@
#include "screens.h"
#include "buttons.h"
using namespace espgui;
namespace {
constexpr const char * const TAG = "DEBUG";
//wl_status_t last_status;
//IPAddress last_ip;
uint8_t consoleControlCharsReceived{};
bool uart0Initialized{};
} // namespace
void initDebugInput()
{
Serial.begin(115200);
//Serial.setDebugOutput(true);
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)
{
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);
}
void handleDebugInput()
{
//const auto status = WiFi.status();
//if (last_status != status)
//{
//Serial.print("Status changed to: ");
//Serial.println(to_string(status).c_str());
//last_status = status;
//}
if (!uart0Initialized)
return;
//const auto ip = WiFi.localIP();
//if (last_ip != ip)
//{
//Serial.print("IP changed to: ");
//Serial.println(to_string(ip).c_str());
//last_ip = ip;
//}
while(Serial.available())
size_t length{};
if (const auto result = uart_get_buffered_data_len(UART_NUM_0, &length); result != ESP_OK)
{
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)
{
case 'i':
case 'I':
tft.init();
espgui::tft.init();
break;
case 'p':
case 'P':
@ -125,4 +135,5 @@ void handleDebugInput()
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.drawSunkenRect(leftMargin, topMargin, width, height,
espgui::tft.color565(240, 240, 240),
espgui::tft.color565(100, 100, 100),
espgui::tft.color565(30, 30, 30));
color565(240, 240, 240),
color565(100, 100, 100),
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 y = topMargin + 5;
@ -71,23 +71,23 @@ void AlertDisplay::initOverlay()
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,
(width - 15 - 10 - 15) / 2,
30,
espgui::tft.color565(240, 240, 240),
espgui::tft.color565(100, 100, 100),
espgui::tft.color565(170, 170, 170));
color565(240, 240, 240),
color565(100, 100, 100),
color565(170, 170, 170));
espgui::tft.drawString("Yes", leftMargin + 18, bottom - 37);
espgui::tft.drawSunkenRect(leftMargin + 15 + ((width - 15 - 30 - 15) / 2) + 15, bottom - 40,
(width - 15 - 10 - 15) / 2,
30,
espgui::tft.color565(240, 240, 240),
espgui::tft.color565(100, 100, 100),
espgui::tft.color565(170, 170, 170));
color565(240, 240, 240),
color565(100, 100, 100),
color565(170, 170, 170));
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;
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
sz[i] = 0; // Out of screen, die.