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
#define HAS_SCREEN 0
#endif
#ifndef HAS_TFT
#define HAS_TFT 0
#endif
#ifndef HAS_WIRE
#define HAS_WIRE 0
#endif

View File

@ -1718,7 +1718,7 @@ void Screen::setup()
#endif
serialSinceMsec = millis();
#if ARCH_PORTDUINO
#if ARCH_PORTDUINO && !HAS_TFT
if (settingsMap[touchscreenModule]) {
touchScreenImpl1 =
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
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
class LGFX : public lgfx::LGFX_Device

View File

@ -40,6 +40,7 @@
#include <utility>
#ifdef ARCH_ESP32
#include "freertosinc.h"
#if !MESHTASTIC_EXCLUDE_WEBSERVER
#include "mesh/http/WebServer.h"
#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
const char *firmware_version = optstr(APP_VERSION_SHORT);
const char *getDeviceName()
{
uint8_t dmac[6];

View File

@ -149,6 +149,9 @@ class PhoneAPI
*/
virtual void onNowHasData(uint32_t fromRadioNum) {}
/// begin a new connection
void handleStartConfig();
private:
void releasePhonePacket();
@ -158,9 +161,6 @@ class PhoneAPI
void releaseClientNotification();
/// begin a new connection
void handleStartConfig();
bool wasSeenRecently(uint32_t packetId);
/**

View File

@ -117,8 +117,10 @@ class CannedMessageModule : public SinglePortModule, public Observable<const UIF
int handleInputEvent(const InputEvent *event);
virtual bool wantUIFrame() override { return this->shouldDraw(); }
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;
#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,
meshtastic_AdminMessage *request,
meshtastic_AdminMessage *response) override;

View File

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

View File

@ -153,6 +153,7 @@ void portduinoSetup()
std::string gpioChipName = "gpiochip";
settingsStrings[i2cdev] = "";
settingsStrings[keyboardDevice] = "";
settingsStrings[pointerDevice] = "";
settingsStrings[webserverrootpath] = "";
settingsStrings[spidev] = "";
settingsStrings[displayspidev] = "";
@ -455,6 +456,8 @@ bool loadConfig(const char *configPath)
settingsMap[displayPanel] = ili9341;
else if (yamlConfig["Display"]["Panel"].as<std::string>("") == "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")
settingsMap[displayPanel] = ili9488;
else if (yamlConfig["Display"]["Panel"].as<std::string>("") == "HX8357D")
@ -515,6 +518,7 @@ bool loadConfig(const char *configPath)
}
if (yamlConfig["Input"]) {
settingsStrings[keyboardDevice] = (yamlConfig["Input"]["KeyboardDevice"]).as<std::string>("");
settingsStrings[pointerDevice] = (yamlConfig["Input"]["PointerDevice"]).as<std::string>("");
}
if (yamlConfig["Webserver"]) {

View File

@ -55,6 +55,7 @@ enum configNames {
displayOffsetY,
displayInvert,
keyboardDevice,
pointerDevice,
logoutputlevel,
traceFilename,
webserver,
@ -66,7 +67,7 @@ enum configNames {
config_directory,
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 { level_error, level_warn, level_info, level_debug, level_trace };

View File

@ -6,14 +6,6 @@
#define USB_VID 0x16D0
#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 BUILTIN_LED LED_BUILTIN // backward compatibility