From ddfe0d34a140cfcde131f2b1801a2cb6d788339c Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Tue, 19 May 2020 23:45:53 +0200 Subject: [PATCH] Added environment for @mickdermack --- bobbycar_noota.csv | 5 ++ platformio.ini | 50 ++++++++++++++++++ src/displays/matrixdisplay.h | 94 ---------------------------------- src/displays/menus/demosmenu.h | 2 - src/screens.h | 3 -- src/texts.h | 2 - src/utils.h | 16 ------ 7 files changed, 55 insertions(+), 117 deletions(-) create mode 100644 bobbycar_noota.csv delete mode 100644 src/displays/matrixdisplay.h diff --git a/bobbycar_noota.csv b/bobbycar_noota.csv new file mode 100644 index 0000000..8560d00 --- /dev/null +++ b/bobbycar_noota.csv @@ -0,0 +1,5 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +app0, app, ota_0, 0x10000, 0x250000, +spiffs, data, spiffs, 0x260000, 0x250000, diff --git a/platformio.ini b/platformio.ini index 0035af4..c8186c2 100644 --- a/platformio.ini +++ b/platformio.ini @@ -151,3 +151,53 @@ build_flags = -DDEFAULT_GASMAX=4095 -DDEFAULT_BREMSMIN=0 -DDEFAULT_BREMSMAX=4095 + + + +[env:mickdermack] +platform = ${common_env_data.platform} +board = ${common_env_data.board} +framework = ${common_env_data.framework} +board_build.partitions = bobbycar_noota.csv +lib_deps = ${common_env_data.lib_deps} +lib_compat_mode = ${common_env_data.lib_compat_mode} +build_unflags = ${common_env_data.build_unflags} + +upload_port = /dev/ttyUSB* +upload_speed = 921600 + +build_flags = + ${common_env_data.build_flags} + -DUSER_SETUP_LOADED=1 + -DRPI_DISPLAY_TYPE + -DILI9486_DRIVER +; TODO: TFT_MISO (touch MISO?) + -DTFT_MISO=17 + -DTFT_MOSI=4 + -DTFT_SCLK=21 + -DTFT_CS=32 + -DTFT_DC=19 + -DTFT_RST=27 +; TODO: TOUCH_CS + -DTOUCH_CS=22 + -DSPI_FREQUENCY=20000000 + -DSPI_TOUCH_FREQUENCY=2500000 + -DPINS_RX1=18 + -DPINS_TX1=19 + -DPINS_RX2=23 + -DPINS_TX2=34 + -DPINS_GAS=35 + -DPINS_BREMS=33 +; -DFEATURE_3WIRESW +; -DPINS_3WIRESW_OUT=17 +; -DPINS_3WIRESW_IN1=4 +; -DPINS_3WIRESW_IN2=16 +; -DFEATURE_ROTARY +; -DPINS_ROTARY_CLK=4 +; -DPINS_ROTARY_DT=16 +; -DPINS_ROTARY_SW=17 + ${default_limits_common_env_data.build_flags} + -DDEFAULT_GASMIN=0 + -DDEFAULT_GASMAX=4095 + -DDEFAULT_BREMSMIN=0 + -DDEFAULT_BREMSMAX=4095 diff --git a/src/displays/matrixdisplay.h b/src/displays/matrixdisplay.h deleted file mode 100644 index 7f7a824..0000000 --- a/src/displays/matrixdisplay.h +++ /dev/null @@ -1,94 +0,0 @@ -#pragma once - -#include "demodisplay.h" -#include "actions/switchscreenaction.h" -#include "globals.h" -#include "utils.h" -#include "texts.h" - -namespace { -class DemosMenu; -} - -namespace { -class MatrixDisplay : public DemoDisplay, public SwitchScreenAction -{ - using Base = DemoDisplay; - -public: - void initScreen() override; - void redraw() override; - void stop() override; - -private: - int scroll_slow(int lines, int wait); - - static constexpr auto TEXT_HEIGHT = 8; // Height of text to be printed and scrolled - static constexpr auto BOT_FIXED_AREA = 0; // Number of lines in bottom fixed area (lines counted from bottom of screen) - static constexpr auto TOP_FIXED_AREA = 0; // Number of lines in top fixed area (lines counted from top of screen) - - uint16_t yStart = TOP_FIXED_AREA; - uint16_t yArea = 320 - TOP_FIXED_AREA - BOT_FIXED_AREA; - uint16_t yDraw = 320 - BOT_FIXED_AREA - TEXT_HEIGHT; - byte pos[42]; - uint16_t xPos = 0; -}; - -void MatrixDisplay::initScreen() -{ - tft.setRotation(2); - tft.fillScreen(TFT_BLACK); - setupScrollArea(TOP_FIXED_AREA, BOT_FIXED_AREA); - - // First fill the screen with random streaks of characters - for (int j = 0; j < 600; j += TEXT_HEIGHT) - { - for (int i = 0; i < 40; i++) - { - if (pos[i] > 20) - pos[i] -= 3; // Rapid fade initially brightness values - - if (pos[i] > 0) - pos[i] -= 1; // Slow fade later - - if ((random(20) == 1) && (j<400)) - pos[i] = 63; // ~1 in 20 probability of a new character - - tft.setTextColor(pos[i] << 5, TFT_BLACK); // Set the green character brightness - - if (pos[i] == 63) - tft.setTextColor(TFT_WHITE, TFT_BLACK); // Draw white character - - xPos += tft.drawChar(random(32, 128), xPos, yDraw, 1); // Draw the character - } - yDraw = scroll_slow(TEXT_HEIGHT, 14); // Scroll, 14ms per pixel line - xPos = 0; - } -} - -void MatrixDisplay::redraw() -{ - yDraw = scroll_slow(320,5); -} - -void MatrixDisplay::stop() -{ - scrollAddress(0); - tft.setRotation(0); -} - -int MatrixDisplay::scroll_slow(int lines, int wait) -{ - int yTemp = yStart; - - for (int i = 0; i < lines; i++) { - yStart++; - if (yStart == 320 - BOT_FIXED_AREA) - yStart = TOP_FIXED_AREA; - scrollAddress(yStart); - delay(wait); - } - - return yTemp; -} -} diff --git a/src/displays/menus/demosmenu.h b/src/displays/menus/demosmenu.h index fc51721..0b2b3b8 100644 --- a/src/displays/menus/demosmenu.h +++ b/src/displays/menus/demosmenu.h @@ -13,7 +13,6 @@ class StarfieldDisplay; class PingPongDisplay; class SpiroDisplay; class GameOfLifeDisplay; -class MatrixDisplay; class MainMenu; } @@ -26,7 +25,6 @@ class DemosMenu : makeComponent, SwitchScreenAction>, makeComponent, SwitchScreenAction>, makeComponent, SwitchScreenAction>, - makeComponent, SwitchScreenAction>, makeComponent, SwitchScreenAction, StaticMenuItemIcon<&icons::back>> > {}; diff --git a/src/screens.h b/src/screens.h index ff789d4..0a9e58d 100644 --- a/src/screens.h +++ b/src/screens.h @@ -35,7 +35,6 @@ #include "displays/dualgraphdisplay.h" #include "displays/gameoflifedisplay.h" #include "displays/lockscreen.h" -#include "displays/matrixdisplay.h" #include "displays/metersdisplay.h" #include "displays/pingpongdisplay.h" #include "displays/poweroffdisplay.h" @@ -97,7 +96,6 @@ union X { DualGraphDisplay dualGraphDisplay; GameOfLifeDisplay gameOfLifeDisplay; Lockscreen lockScreen; - MatrixDisplay matrixDisplay; MetersDisplay metersDisplay; PingPongDisplay pingPongDisplay; PoweroffDisplay poweroffDisplay; @@ -212,7 +210,6 @@ template<> decltype(displays.calibrateDisplay) & template<> decltype(displays.dualGraphDisplay) &getRefByType() { return displays.dualGraphDisplay; } template<> decltype(displays.gameOfLifeDisplay) &getRefByType() { return displays.gameOfLifeDisplay; } template<> decltype(displays.lockScreen) &getRefByType() { return displays.lockScreen; } -template<> decltype(displays.matrixDisplay) &getRefByType() { return displays.matrixDisplay; } template<> decltype(displays.metersDisplay) &getRefByType() { return displays.metersDisplay; } template<> decltype(displays.pingPongDisplay) &getRefByType() { return displays.pingPongDisplay; } template<> decltype(displays.poweroffDisplay) &getRefByType() { return displays.poweroffDisplay; } diff --git a/src/texts.h b/src/texts.h index 84f16d2..f27b52e 100644 --- a/src/texts.h +++ b/src/texts.h @@ -100,8 +100,6 @@ constexpr char TEXT_STARFIELD[] = "Starfield"; constexpr char TEXT_PINGPONG[] = "PingPong"; constexpr char TEXT_SPIRO[] = "Spiro"; constexpr char TEXT_GAMEOFLIFE[] = "GameOfLife"; -constexpr char TEXT_METERS[] = "Meters"; -constexpr char TEXT_MATRIX[] = "Matrix"; //constexpr char TEXT_BACK[] = "Back"; //BuzzerMenu diff --git a/src/utils.h b/src/utils.h index 2deb5aa..b0fc43d 100644 --- a/src/utils.h +++ b/src/utils.h @@ -248,22 +248,6 @@ void sendCommands() template void switchScreen(Args&&... args); -void setupScrollArea(uint16_t TFA, uint16_t BFA) { - tft.writecommand(ILI9341_VSCRDEF); // Vertical scroll definition - tft.writedata(TFA >> 8); - tft.writedata(TFA); - tft.writedata((320 - TFA - BFA) >> 8); - tft.writedata(320 - TFA - BFA); - tft.writedata(BFA >> 8); - tft.writedata(BFA); -} - -void scrollAddress(uint16_t VSP) { - tft.writecommand(ILI9341_VSCRSADD); // Vertical scrolling start address - tft.writedata(VSP >> 8); - tft.writedata(VSP); -} - void updateSwapFrontBack() { front.serial = settings.hardware.swapFrontBack ? Serial2 : Serial1;