Compare commits

...

5 Commits

Author SHA1 Message Date
GUVWAF
6b8cf164e9
Save some flash usage on STM32WL (#5819)
Some checks are pending
CI / build-esp32 (push) Blocked by required conditions
CI / build-esp32-s3 (push) Blocked by required conditions
CI / build-esp32-c3 (push) Blocked by required conditions
CI / build-esp32-c6 (push) Blocked by required conditions
CI / build-nrf52 (push) Blocked by required conditions
CI / build-rpi2040 (push) Blocked by required conditions
CI / build-stm32 (push) Blocked by required conditions
CI / package-raspbian (push) Waiting to run
CI / package-raspbian-armv7l (push) Waiting to run
CI / package-native (push) Waiting to run
CI / build-debian-src (push) Waiting to run
CI / test-native (push) Waiting to run
CI / build-docker (push) Waiting to run
CI / after-checks (push) Blocked by required conditions
CI / gather-artifacts (esp32) (push) Blocked by required conditions
CI / gather-artifacts (esp32c3) (push) Blocked by required conditions
CI / gather-artifacts (esp32c6) (push) Blocked by required conditions
CI / gather-artifacts (esp32s3) (push) Blocked by required conditions
CI / gather-artifacts (nrf52840) (push) Blocked by required conditions
CI / gather-artifacts (rp2040) (push) Blocked by required conditions
CI / gather-artifacts (stm32) (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions
CI / release-firmware (esp32) (push) Blocked by required conditions
CI / release-firmware (esp32c3) (push) Blocked by required conditions
CI / release-firmware (esp32c6) (push) Blocked by required conditions
CI / release-firmware (esp32s3) (push) Blocked by required conditions
CI / release-firmware (nrf52840) (push) Blocked by required conditions
CI / release-firmware (rp2040) (push) Blocked by required conditions
CI / release-firmware (stm32) (push) Blocked by required conditions
Flawfinder Scan / Flawfinder (push) Waiting to run
2025-01-11 07:20:32 -06:00
GUVWAF
812aa35f09
Enable Tx interrupt immediately after startTransmit() (#5820) 2025-01-11 07:19:17 -06:00
Eric Severance
e7802d960f
Manage when destructor is called for native HttpAPI (#5807) 2025-01-11 06:15:50 -06:00
Tom Fifield
077ee02426
Cherry-pick: Meshtab streamline and rotation fixes (#5812)
* mesh-tab: streamline target definitions

* mesh-tab: fix touch rotation 4.0 inch display

* Mesh-Tab platformio: 4.0inch: increase SPI frequency to max

* mesh-tab: fix rotation for 3.5 IPS capacitive display

* mesh-tab: fix rotation for 3.2 IPS capacitive display

---------

Co-authored-by: mverch67 <manuel.verch@gmx.de>
2025-01-11 05:52:28 -06:00
Tom Fifield
46ea39af45
Quote filename in device-install.sh (#5814)
Without these quotes, a filename with spaces would be interpreted as
different arguments.

Thanks to @Hnikar-az for the report.

fixes https://github.com/meshtastic/firmware/issues/5795
2025-01-11 10:10:04 +01:00
9 changed files with 91 additions and 144 deletions

View File

@ -73,7 +73,7 @@ shift "$((OPTIND - 1))"
if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then
echo "Trying to flash ${FILENAME}, but first erasing and writing system information"
$ESPTOOL_CMD erase_flash
$ESPTOOL_CMD write_flash 0x00 ${FILENAME}
$ESPTOOL_CMD write_flash 0x00 "${FILENAME}"
# Account for S3 board's different OTA partition
if [ -n "${FILENAME##*"s3"*}" ] && [ -n "${FILENAME##*"-v3"*}" ] && [ -n "${FILENAME##*"t-deck"*}" ] && [ -n "${FILENAME##*"wireless-paper"*}" ] && [ -n "${FILENAME##*"wireless-tracker"*}" ] && [ -n "${FILENAME##*"station-g2"*}" ] && [ -n "${FILENAME##*"unphone"*}" ]; then
if [ -n "${FILENAME##*"esp32c3"*}" ]; then

View File

@ -92,6 +92,7 @@ NRF52Bluetooth *nrf52Bluetooth = nullptr;
#include "mesh/raspihttp/PiWebServer.h"
#include "platform/portduino/PortduinoGlue.h"
#include "platform/portduino/USBHal.h"
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>
@ -1159,6 +1160,7 @@ void setup()
#if __has_include(<ulfius.h>)
if (settingsMap[webserverport] != -1) {
piwebServerThread = new PiWebServerThread();
std::atexit([] { delete piwebServerThread; });
}
#endif
initApiServer(TCPPort);
@ -1278,4 +1280,4 @@ void loop()
mainDelay.delay(delayMsec);
}
}
#endif
#endif

View File

@ -297,7 +297,7 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(float snr)
void printPacket(const char *prefix, const meshtastic_MeshPacket *p)
{
#ifdef DEBUG_PORT
#if defined(DEBUG_PORT) && !defined(DEBUG_MUTE)
std::string out = DEBUG_PORT.mt_sprintf("%s (id=0x%08x fr=0x%08x to=0x%08x, WantAck=%d, HopLim=%d Ch=0x%x", prefix, p->id,
p->from, p->to, p->want_ack, p->hop_limit, p->channel);
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
@ -637,4 +637,4 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p)
sendingPacket = p;
return p->encrypted.size + sizeof(PacketHeader);
}
}

View File

@ -501,14 +501,13 @@ bool RadioLibInterface::startSend(meshtastic_MeshPacket *txp)
powerMon->clearState(meshtastic_PowerMon_State_Lora_TXOn); // Transmitter off now
startReceive(); // Restart receive mode (because startTransmit failed to put us in xmit mode)
} else {
// Must be done AFTER, starting transmit, because startTransmit clears (possibly stale) interrupt pending register
// bits
enableInterrupt(isrTxLevel0);
lastTxStart = millis();
printPacket("Started Tx", txp);
}
// Must be done AFTER, starting transmit, because startTransmit clears (possibly stale) interrupt pending register
// bits
enableInterrupt(isrTxLevel0);
return res == RADIOLIB_ERR_NONE;
}
}

View File

@ -82,8 +82,6 @@ char contentTypes[][2][32] = {{".txt", "text/plain"}, {".html", "text/html"
volatile bool isWebServerReady;
volatile bool isCertReady;
HttpAPI webAPI;
PiWebServerThread *piwebServerThread;
/**
@ -247,7 +245,7 @@ int handleAPIv1ToRadio(const struct _u_request *req, struct _u_response *res, vo
portduinoVFS->mountpoint(configWeb.rootPath);
LOG_DEBUG("Received %d bytes from PUT request", s);
webAPI.handleToRadio(buffer, s);
static_cast<HttpAPI *>(user_data)->handleToRadio(buffer, s);
LOG_DEBUG("end web->radio ");
return U_CALLBACK_COMPLETE;
}
@ -279,7 +277,7 @@ int handleAPIv1FromRadio(const struct _u_request *req, struct _u_response *res,
if (valueAll == "true") {
while (len) {
len = webAPI.getFromRadio(txBuf);
len = static_cast<HttpAPI *>(user_data)->getFromRadio(txBuf);
ulfius_set_response_properties(res, U_OPT_STATUS, 200, U_OPT_BINARY_BODY, txBuf, len);
const char *tmpa = (const char *)txBuf;
ulfius_set_string_body_response(res, 200, tmpa);
@ -289,7 +287,7 @@ int handleAPIv1FromRadio(const struct _u_request *req, struct _u_response *res,
}
// Otherwise, just return one protobuf
} else {
len = webAPI.getFromRadio(txBuf);
len = static_cast<HttpAPI *>(user_data)->getFromRadio(txBuf);
const char *tmpa = (const char *)txBuf;
ulfius_set_binary_body_response(res, 200, tmpa, len);
// LOG_DEBUG("\n----webAPI response:");
@ -497,10 +495,10 @@ PiWebServerThread::PiWebServerThread()
u_map_put(instanceWeb.default_headers, "Access-Control-Allow-Origin", "*");
// Maximum body size sent by the client is 1 Kb
instanceWeb.max_post_body_size = 1024;
ulfius_add_endpoint_by_val(&instanceWeb, "GET", PREFIX, "/api/v1/fromradio/*", 1, &handleAPIv1FromRadio, NULL);
ulfius_add_endpoint_by_val(&instanceWeb, "OPTIONS", PREFIX, "/api/v1/fromradio/*", 1, &handleAPIv1FromRadio, NULL);
ulfius_add_endpoint_by_val(&instanceWeb, "PUT", PREFIX, "/api/v1/toradio/*", 1, &handleAPIv1ToRadio, configWeb.rootPath);
ulfius_add_endpoint_by_val(&instanceWeb, "OPTIONS", PREFIX, "/api/v1/toradio/*", 1, &handleAPIv1ToRadio, NULL);
ulfius_add_endpoint_by_val(&instanceWeb, "GET", PREFIX, "/api/v1/fromradio/*", 1, &handleAPIv1FromRadio, &webAPI);
ulfius_add_endpoint_by_val(&instanceWeb, "OPTIONS", PREFIX, "/api/v1/fromradio/*", 1, &handleAPIv1FromRadio, &webAPI);
ulfius_add_endpoint_by_val(&instanceWeb, "PUT", PREFIX, "/api/v1/toradio/*", 1, &handleAPIv1ToRadio, &webAPI);
ulfius_add_endpoint_by_val(&instanceWeb, "OPTIONS", PREFIX, "/api/v1/toradio/*", 1, &handleAPIv1ToRadio, &webAPI);
// Add callback function to all endpoints for the Web Server
ulfius_add_endpoint_by_val(&instanceWeb, "GET", NULL, "/*", 2, &callback_static_file, &configWeb);
@ -525,13 +523,12 @@ PiWebServerThread::~PiWebServerThread()
u_map_clean(&configWeb.mime_types);
ulfius_stop_framework(&instanceWeb);
ulfius_stop_framework(&instanceWeb);
ulfius_clean_instance(&instanceWeb);
free(configWeb.rootPath);
ulfius_clean_instance(&instanceService);
ulfius_clean_instance(&instanceService);
free(key_pem);
free(cert_pem);
LOG_INFO("End framework");
}
#endif
#endif
#endif

View File

@ -23,24 +23,6 @@ struct _file_config {
char *rootPath;
};
class PiWebServerThread
{
private:
char *key_pem = NULL;
char *cert_pem = NULL;
// struct _u_map mime_types;
std::string webrootpath;
public:
PiWebServerThread();
~PiWebServerThread();
int CreateSSLCertificate();
int CheckSSLandLoad();
uint32_t requestRestart = 0;
struct _u_instance instanceWeb;
struct _u_instance instanceService;
};
class HttpAPI : public PhoneAPI
{
@ -55,6 +37,24 @@ class HttpAPI : public PhoneAPI
virtual bool checkIsConnected() override { return true; } // FIXME, be smarter about this
};
class PiWebServerThread
{
private:
char *key_pem = NULL;
char *cert_pem = NULL;
// struct _u_map mime_types;
std::string webrootpath;
HttpAPI webAPI;
public:
PiWebServerThread();
~PiWebServerThread();
int CreateSSLCertificate();
int CheckSSLandLoad();
uint32_t requestRestart = 0;
struct _u_instance instanceWeb;
};
extern PiWebServerThread *piwebServerThread;
#endif

View File

@ -56,18 +56,10 @@ build_src_filter = ${esp32_base.build_src_filter}
lib_deps = ${esp32_base.lib_deps}
lovyan03/LovyanGFX@^1.1.16
; 3.2" TN TFT ST7789 / XPT2046: https://vi.aliexpress.com/item/1005005933490544.html
[env:mesh-tab-3-2-TN-resistive]
[mesh_tab_xpt2046]
extends = mesh_tab_base
build_flags = ${mesh_tab_base.build_flags}
-D LGFX_SCREEN_WIDTH=240
-D LGFX_SCREEN_HEIGHT=320
-D LGFX_PANEL=ST7789
-D LGFX_INVERT_COLOR=false
-D LGFX_RGB_ORDER=false
-D LGFX_ROTATION=3
-D LGFX_TOUCH=XPT2046
-D SPI_FREQUENCY=60000000
-D LGFX_TOUCH_SPI_FREQ=2500000
-D LGFX_TOUCH_SPI_HOST=2
-D LGFX_TOUCH_CS=7
@ -78,156 +70,109 @@ build_flags = ${mesh_tab_base.build_flags}
-D LGFX_TOUCH_X_MAX=3900
-D LGFX_TOUCH_Y_MIN=400
-D LGFX_TOUCH_Y_MAX=3900
[mesh_tab_ft5x06]
extends = mesh_tab_base
build_flags = ${mesh_tab_base.build_flags}
-D LGFX_TOUCH=FT5x06
-D LGFX_TOUCH_I2C_FREQ=400000
-D LGFX_TOUCH_I2C_PORT=0
-D LGFX_TOUCH_I2C_ADDR=0x38
-D LGFX_TOUCH_I2C_SDA=8
-D LGFX_TOUCH_I2C_SCL=9
-D LGFX_TOUCH_RST=7
; 3.2" TN TFT ST7789 / XPT2046: https://vi.aliexpress.com/item/1005005933490544.html
[env:mesh-tab-3-2-TN-resistive]
extends = mesh_tab_base
build_flags = ${mesh_tab_xpt2046.build_flags}
-D SPI_FREQUENCY=60000000
-D LGFX_SCREEN_WIDTH=240
-D LGFX_SCREEN_HEIGHT=320
-D LGFX_PANEL=ST7789
-D LGFX_INVERT_COLOR=false
-D LGFX_ROTATION=3
-D LGFX_TOUCH_ROTATION=4
; 3.2" IPS TFT ILI9341 / XPT2046: https://www.aliexpress.com/item/1005006258575617.html
[env:mesh-tab-3-2-IPS-resistive]
extends = mesh_tab_base
build_flags = ${mesh_tab_base.build_flags}
build_flags = ${mesh_tab_xpt2046.build_flags}
-D SPI_FREQUENCY=60000000 ; if image is distorted then lower to 40 MHz
-D LGFX_SCREEN_WIDTH=240
-D LGFX_SCREEN_HEIGHT=320
-D LGFX_PANEL=ILI9341
-D LGFX_INVERT_COLOR=true
-D LGFX_RGB_ORDER=false
-D LGFX_ROTATION=1
-D LGFX_TOUCH=XPT2046
-D SPI_FREQUENCY=60000000 ; if image is distorted then lower to 40 MHz
-D LGFX_TOUCH_SPI_FREQ=2500000
-D LGFX_TOUCH_SPI_HOST=2
-D LGFX_TOUCH_CS=7
-D LGFX_TOUCH_CLK=12
-D LGFX_TOUCH_DO=11
-D LGFX_TOUCH_DIN=13
-D LGFX_TOUCH_X_MIN=300
-D LGFX_TOUCH_X_MAX=3900
-D LGFX_TOUCH_Y_MIN=400
-D LGFX_TOUCH_Y_MAX=3900
-D LGFX_TOUCH_ROTATION=4
; 3.5" IPS TFT ILI9488 / XPT2046: https://vi.aliexpress.com/item/1005006333922639.html
[env:mesh-tab-3-5-IPS-resistive]
extends = mesh_tab_base
build_flags = ${mesh_tab_base.build_flags}
build_flags = ${mesh_tab_xpt2046.build_flags}
-D SPI_FREQUENCY=60000000 ; may go higher upto 40/60/80 MHz
-D DISPLAY_SET_RESOLUTION
-D LGFX_SCREEN_WIDTH=320
-D LGFX_SCREEN_HEIGHT=480
-D LGFX_PANEL=ILI9488
-D LGFX_INVERT_COLOR=true
-D LGFX_RGB_ORDER=false
-D LGFX_DLEN_16BITS=false
-D LGFX_ROTATION=0
-D LGFX_TOUCH=XPT2046
-D SPI_FREQUENCY=40000000 ; may go higher upto 40/60/80 MHz
-D LGFX_TOUCH_SPI_FREQ=2500000
-D LGFX_TOUCH_SPI_HOST=2
-D LGFX_TOUCH_CS=7
-D LGFX_TOUCH_CLK=12
-D LGFX_TOUCH_DO=11
-D LGFX_TOUCH_DIN=13
-D LGFX_TOUCH_X_MIN=300
-D LGFX_TOUCH_X_MAX=3900
-D LGFX_TOUCH_Y_MIN=400
-D LGFX_TOUCH_Y_MAX=3900
-D LGFX_TOUCH_ROTATION=0
; 3.5" TN TFT ILI9488 / XPT2046: https://vi.aliexpress.com/item/32985467436.html
[env:mesh-tab-3-5-TN-resistive]
extends = mesh_tab_base
build_flags = ${mesh_tab_base.build_flags}
build_flags = ${mesh_tab_xpt2046.build_flags}
-D SPI_FREQUENCY=60000000
-D DISPLAY_SET_RESOLUTION
-D LGFX_SCREEN_WIDTH=320
-D LGFX_SCREEN_HEIGHT=480
-D LGFX_PANEL=HX8357B
-D SPI_FREQUENCY=60000000
-D LGFX_INVERT_COLOR=false
-D LGFX_RGB_ORDER=false
-D LGFX_DLEN_16BITS=false
-D LGFX_ROTATION=4
-D LGFX_TOUCH=XPT2046
-D LGFX_TOUCH_SPI_FREQ=2500000
-D LGFX_TOUCH_SPI_HOST=2
-D LGFX_TOUCH_CS=7
-D LGFX_TOUCH_CLK=12
-D LGFX_TOUCH_DO=11
-D LGFX_TOUCH_DIN=13
-D LGFX_TOUCH_X_MIN=300
-D LGFX_TOUCH_X_MAX=3900
-D LGFX_TOUCH_Y_MIN=400
-D LGFX_TOUCH_Y_MAX=3900
-D LGFX_TOUCH_ROTATION=2
; 3.2" IPS TFT ILI9341 / FT6236: https://vi.aliexpress.com/item/1005006624072350.html
[env:mesh-tab-3-2-IPS-capacitive]
extends = mesh_tab_base
build_flags = ${mesh_tab_base.build_flags}
build_flags = ${mesh_tab_ft5x06.build_flags}
-D SPI_FREQUENCY=75000000 ; may go higher upto 60/80 MHz
-D LGFX_SCREEN_WIDTH=240
-D LGFX_SCREEN_HEIGHT=320
-D LGFX_PANEL=ILI9341
-D LGFX_INVERT_COLOR=true
-D LGFX_RGB_ORDER=false
-D LGFX_ROTATION=1
-D LGFX_TOUCH=FT5x06
-D SPI_FREQUENCY=40000000 ; may go higher upto 60/80 MHz
-D LGFX_TOUCH_I2C_PORT=0
-D LGFX_TOUCH_I2C_ADDR=0x38
-D LGFX_TOUCH_I2C_SDA=8
-D LGFX_TOUCH_I2C_SCL=9
-D LGFX_TOUCH_RST=7
-D LGFX_TOUCH_X_MIN=0
-D LGFX_TOUCH_X_MAX=239
-D LGFX_TOUCH_Y_MIN=0
-D LGFX_TOUCH_Y_MAX=319
-D LGFX_TOUCH_ROTATION=2
; 3.5" IPS TFT ILI9488 / FT6236: https://vi.aliexpress.com/item/1005006893699919.html
[env:mesh-tab-3-5-IPS-capacitive]
extends = mesh_tab_base
build_flags = ${mesh_tab_ft5x06.build_flags}
-D SPI_FREQUENCY=75000000 ; may go higher upto 40/60/80 MHz
-D DISPLAY_SET_RESOLUTION
-D LGFX_SCREEN_WIDTH=320
-D LGFX_SCREEN_HEIGHT=480
-D LGFX_PANEL=ILI9488
-D LGFX_ROTATION=2
-D LGFX_TOUCH_X_MIN=0
-D LGFX_TOUCH_X_MAX=319
-D LGFX_TOUCH_Y_MIN=0
-D LGFX_TOUCH_Y_MAX=479
-D LGFX_TOUCH_ROTATION=0
-D LGFX_TOUCH_I2C_FREQ=400000
; 3.5" IPS TFT ILI9488 / FT6236: https://vi.aliexpress.com/item/1005006893699919.html
[env:mesh-tab-3-5-IPS-capacitive]
extends = mesh_tab_base
build_flags = ${mesh_tab_base.build_flags}
-D DISPLAY_SET_RESOLUTION
-D LGFX_SCREEN_WIDTH=320
-D LGFX_SCREEN_HEIGHT=480
-D LGFX_PANEL=ILI9488
-D LGFX_INVERT_COLOR=true
-D LGFX_RGB_ORDER=false
-D LGFX_DLEN_16BITS=false
-D LGFX_ROTATION=1
-D LGFX_TOUCH=FT5x06
-D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz
-D LGFX_TOUCH_I2C_PORT=0
-D LGFX_TOUCH_I2C_ADDR=0x38
-D LGFX_TOUCH_I2C_SDA=8
-D LGFX_TOUCH_I2C_SCL=9
-D LGFX_TOUCH_RST=7
-D LGFX_TOUCH_X_MIN=0
-D LGFX_TOUCH_X_MAX=319
-D LGFX_TOUCH_Y_MIN=0
-D LGFX_TOUCH_Y_MAX=479
-D LGFX_TOUCH_ROTATION=1
-D LGFX_TOUCH_I2C_FREQ=400000
; 4.0" IPS TFT ILI9488 / FT6236: https://vi.aliexpress.com/item/1005007082906950.html
[env:mesh-tab-4-0-IPS-capacitive]
extends = mesh_tab_base
build_flags = ${mesh_tab_base.build_flags}
build_flags = ${mesh_tab_ft5x06.build_flags}
-D SPI_FREQUENCY=75000000
-D DISPLAY_SET_RESOLUTION
-D LGFX_SCREEN_WIDTH=320
-D LGFX_SCREEN_HEIGHT=480
-D LGFX_PANEL=HX8357B
-D LGFX_INVERT_COLOR=true
-D LGFX_RGB_ORDER=false
-D LGFX_DLEN_16BITS=false
-D LGFX_ROTATION=4
-D LGFX_TOUCH=FT5x06
-D SPI_FREQUENCY=30000000 ; may go higher upto 40/60/80 MHz
-D LGFX_TOUCH_I2C_PORT=0
-D LGFX_TOUCH_I2C_ADDR=0x38
-D LGFX_TOUCH_I2C_SDA=8
-D LGFX_TOUCH_I2C_SCL=9
-D LGFX_TOUCH_RST=7
-D LGFX_TOUCH_X_MIN=0
-D LGFX_TOUCH_X_MAX=319
-D LGFX_TOUCH_Y_MIN=0
-D LGFX_TOUCH_Y_MAX=479
-D LGFX_TOUCH_ROTATION=1
-D LGFX_TOUCH_I2C_FREQ=400000
-D LGFX_TOUCH_ROTATION=6

View File

@ -28,6 +28,8 @@ build_flags =
-DHAL_TIM_MODULE_DISABLED
-DHAL_WWDG_MODULE_DISABLED
-DHAL_EXTI_MODULE_DISABLED
-DHAL_SAI_MODULE_DISABLED
-DHAL_ICACHE_MODULE_DISABLED
-DRADIOLIB_EXCLUDE_SX128X=1
-DRADIOLIB_EXCLUDE_SX127X=1
-DRADIOLIB_EXCLUDE_LR11X0=1

View File

@ -28,6 +28,8 @@ build_flags =
-DHAL_TIM_MODULE_DISABLED
-DHAL_WWDG_MODULE_DISABLED
-DHAL_EXTI_MODULE_DISABLED
-DHAL_SAI_MODULE_DISABLED
-DHAL_ICACHE_MODULE_DISABLED
-DRADIOLIB_EXCLUDE_SX128X=1
-DRADIOLIB_EXCLUDE_SX127X=1
-DRADIOLIB_EXCLUDE_LR11X0=1