TFT branch grab-bag (#5683)

Selection of minor edits from the TFT branch that are too
challenging to cherry-pick cleanly, including:
* introducing the HAS_TFT flag
* fixing pins in unphone
* Adding pinterdevice to portduino settings
This commit is contained in:
Tom Fifield 2024-12-29 01:31:54 +11:00 committed by GitHub
parent 31a5b9c122
commit 43d6b31603
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 27 additions and 22 deletions

View File

@ -250,6 +250,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef HAS_SCREEN #ifndef HAS_SCREEN
#define HAS_SCREEN 0 #define HAS_SCREEN 0
#endif #endif
#ifndef HAS_TFT
#define HAS_TFT 0
#endif
#ifndef HAS_WIRE #ifndef HAS_WIRE
#define HAS_WIRE 0 #define HAS_WIRE 0
#endif #endif
@ -362,4 +365,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif #endif
#include "DebugConfiguration.h" #include "DebugConfiguration.h"
#include "RF95Configuration.h" #include "RF95Configuration.h"

View File

@ -1718,7 +1718,7 @@ void Screen::setup()
#endif #endif
serialSinceMsec = millis(); serialSinceMsec = millis();
#if ARCH_PORTDUINO #if ARCH_PORTDUINO && !HAS_TFT
if (settingsMap[touchscreenModule]) { if (settingsMap[touchscreenModule]) {
touchScreenImpl1 = touchScreenImpl1 =
new TouchScreenImpl1(dispdev->getWidth(), dispdev->getHeight(), static_cast<TFTDisplay *>(dispdev)->getTouch); new TouchScreenImpl1(dispdev->getWidth(), dispdev->getHeight(), static_cast<TFTDisplay *>(dispdev)->getTouch);

View File

@ -347,7 +347,7 @@ static LGFX *tft = nullptr;
#include <TFT_eSPI.h> // Graphics and font library for ILI9342 driver chip #include <TFT_eSPI.h> // Graphics and font library for ILI9342 driver chip
static TFT_eSPI *tft = nullptr; // Invoke library, pins defined in User_Setup.h static TFT_eSPI *tft = nullptr; // Invoke library, pins defined in User_Setup.h
#elif ARCH_PORTDUINO && HAS_SCREEN != 0 #elif ARCH_PORTDUINO && HAS_SCREEN != 0 && !HAS_TFT
#include <LovyanGFX.hpp> // Graphics and font library for ST7735 driver chip #include <LovyanGFX.hpp> // Graphics and font library for ST7735 driver chip
class LGFX : public lgfx::LGFX_Device class LGFX : public lgfx::LGFX_Device

View File

@ -40,6 +40,7 @@
#include <utility> #include <utility>
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32
#include "freertosinc.h"
#if !MESHTASTIC_EXCLUDE_WEBSERVER #if !MESHTASTIC_EXCLUDE_WEBSERVER
#include "mesh/http/WebServer.h" #include "mesh/http/WebServer.h"
#endif #endif
@ -173,6 +174,8 @@ std::pair<uint8_t, TwoWire *> nodeTelemetrySensorsMap[_meshtastic_TelemetrySenso
Router *router = NULL; // Users of router don't care what sort of subclass implements that API Router *router = NULL; // Users of router don't care what sort of subclass implements that API
const char *firmware_version = optstr(APP_VERSION_SHORT);
const char *getDeviceName() const char *getDeviceName()
{ {
uint8_t dmac[6]; uint8_t dmac[6];
@ -1275,4 +1278,4 @@ void loop()
mainDelay.delay(delayMsec); mainDelay.delay(delayMsec);
} }
} }
#endif #endif

View File

@ -149,6 +149,9 @@ class PhoneAPI
*/ */
virtual void onNowHasData(uint32_t fromRadioNum) {} virtual void onNowHasData(uint32_t fromRadioNum) {}
/// begin a new connection
void handleStartConfig();
private: private:
void releasePhonePacket(); void releasePhonePacket();
@ -158,9 +161,6 @@ class PhoneAPI
void releaseClientNotification(); void releaseClientNotification();
/// begin a new connection
void handleStartConfig();
bool wasSeenRecently(uint32_t packetId); bool wasSeenRecently(uint32_t packetId);
/** /**
@ -171,4 +171,4 @@ class PhoneAPI
/// If the mesh service tells us fromNum has changed, tell the phone /// If the mesh service tells us fromNum has changed, tell the phone
virtual int onNotify(uint32_t newValue) override; virtual int onNotify(uint32_t newValue) override;
}; };

View File

@ -430,4 +430,4 @@ uint8_t getWifiDisconnectReason()
{ {
return wifiDisconnectReason; return wifiDisconnectReason;
} }
#endif #endif

View File

@ -117,8 +117,10 @@ class CannedMessageModule : public SinglePortModule, public Observable<const UIF
int handleInputEvent(const InputEvent *event); int handleInputEvent(const InputEvent *event);
virtual bool wantUIFrame() override { return this->shouldDraw(); } virtual bool wantUIFrame() override { return this->shouldDraw(); }
virtual Observable<const UIFrameEvent *> *getUIFrameObservable() override { return this; } virtual Observable<const UIFrameEvent *> *getUIFrameObservable() override { return this; }
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override;
virtual bool interceptingKeyboardInput() override; virtual bool interceptingKeyboardInput() override;
#if !HAS_TFT
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override;
#endif
virtual AdminMessageHandleResult handleAdminMessageForModule(const meshtastic_MeshPacket &mp, virtual AdminMessageHandleResult handleAdminMessageForModule(const meshtastic_MeshPacket &mp,
meshtastic_AdminMessage *request, meshtastic_AdminMessage *request,
meshtastic_AdminMessage *response) override; meshtastic_AdminMessage *response) override;
@ -228,4 +230,4 @@ class CannedMessageModule : public SinglePortModule, public Observable<const UIF
}; };
extern CannedMessageModule *cannedMessageModule; extern CannedMessageModule *cannedMessageModule;
#endif #endif

View File

@ -173,7 +173,7 @@ void setupModules()
aSerialKeyboardImpl->init(); aSerialKeyboardImpl->init();
#endif // INPUTBROKER_MATRIX_TYPE #endif // INPUTBROKER_MATRIX_TYPE
#endif // HAS_BUTTON #endif // HAS_BUTTON
#if ARCH_PORTDUINO #if ARCH_PORTDUINO && !HAS_TFT
aLinuxInputImpl = new LinuxInputImpl(); aLinuxInputImpl = new LinuxInputImpl();
aLinuxInputImpl->init(); aLinuxInputImpl->init();
#endif #endif

View File

@ -153,6 +153,7 @@ void portduinoSetup()
std::string gpioChipName = "gpiochip"; std::string gpioChipName = "gpiochip";
settingsStrings[i2cdev] = ""; settingsStrings[i2cdev] = "";
settingsStrings[keyboardDevice] = ""; settingsStrings[keyboardDevice] = "";
settingsStrings[pointerDevice] = "";
settingsStrings[webserverrootpath] = ""; settingsStrings[webserverrootpath] = "";
settingsStrings[spidev] = ""; settingsStrings[spidev] = "";
settingsStrings[displayspidev] = ""; settingsStrings[displayspidev] = "";
@ -455,6 +456,8 @@ bool loadConfig(const char *configPath)
settingsMap[displayPanel] = ili9341; settingsMap[displayPanel] = ili9341;
else if (yamlConfig["Display"]["Panel"].as<std::string>("") == "ILI9342") else if (yamlConfig["Display"]["Panel"].as<std::string>("") == "ILI9342")
settingsMap[displayPanel] = ili9342; settingsMap[displayPanel] = ili9342;
else if (yamlConfig["Display"]["Panel"].as<std::string>("") == "ILI9486")
settingsMap[displayPanel] = ili9486;
else if (yamlConfig["Display"]["Panel"].as<std::string>("") == "ILI9488") else if (yamlConfig["Display"]["Panel"].as<std::string>("") == "ILI9488")
settingsMap[displayPanel] = ili9488; settingsMap[displayPanel] = ili9488;
else if (yamlConfig["Display"]["Panel"].as<std::string>("") == "HX8357D") else if (yamlConfig["Display"]["Panel"].as<std::string>("") == "HX8357D")
@ -515,6 +518,7 @@ bool loadConfig(const char *configPath)
} }
if (yamlConfig["Input"]) { if (yamlConfig["Input"]) {
settingsStrings[keyboardDevice] = (yamlConfig["Input"]["KeyboardDevice"]).as<std::string>(""); settingsStrings[keyboardDevice] = (yamlConfig["Input"]["KeyboardDevice"]).as<std::string>("");
settingsStrings[pointerDevice] = (yamlConfig["Input"]["PointerDevice"]).as<std::string>("");
} }
if (yamlConfig["Webserver"]) { if (yamlConfig["Webserver"]) {
@ -570,4 +574,4 @@ bool MAC_from_string(std::string mac_str, uint8_t *dmac)
} else { } else {
return false; return false;
} }
} }

View File

@ -55,6 +55,7 @@ enum configNames {
displayOffsetY, displayOffsetY,
displayInvert, displayInvert,
keyboardDevice, keyboardDevice,
pointerDevice,
logoutputlevel, logoutputlevel,
traceFilename, traceFilename,
webserver, webserver,
@ -66,7 +67,7 @@ enum configNames {
config_directory, config_directory,
mac_address mac_address
}; };
enum { no_screen, x11, st7789, st7735, st7735s, st7796, ili9341, ili9342, ili9488, hx8357d }; enum { no_screen, x11, st7789, st7735, st7735s, st7796, ili9341, ili9342, ili9486, ili9488, hx8357d };
enum { no_touchscreen, xpt2046, stmpe610, gt911, ft5x06 }; enum { no_touchscreen, xpt2046, stmpe610, gt911, ft5x06 };
enum { level_error, level_warn, level_info, level_debug, level_trace }; enum { level_error, level_warn, level_info, level_debug, level_trace };

View File

@ -6,14 +6,6 @@
#define USB_VID 0x16D0 #define USB_VID 0x16D0
#define USB_PID 0x1178 #define USB_PID 0x1178
#define EXTERNAL_NUM_INTERRUPTS 46
#define NUM_DIGITAL_PINS 48
#define NUM_ANALOG_INPUTS 20
#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
#define digitalPinHasPWM(p) (p < 46)
#define LED_BUILTIN 13 #define LED_BUILTIN 13
#define BUILTIN_LED LED_BUILTIN // backward compatibility #define BUILTIN_LED LED_BUILTIN // backward compatibility