upgrade to new IDF / arduino version

This commit is contained in:
Hansi, dl9rdz 2024-08-12 14:19:01 +00:00
parent 9b9980df05
commit 9056ee443f
33 changed files with 308 additions and 162 deletions

View File

@ -12,13 +12,33 @@ generate_website_index() {
echo '<div class="wrapper"><header><h1><a href="https://dl9rdz.github.io/rdz_ttgo_sonde/">rdz_ttgo_sonde</a></h1><p></p>' >> download.html
echo '<p class="view"><a href="https://github.com/dl9rdz/rdz_ttgo_sonde">View the Project on GitHub <small>dl9rdz/rdz_ttgo_sonde</small></a></p>' >> download.html
echo '</header><section><h1 id="rdz_ttgo_sonde">rdz_ttgo_sonde</h1>' >> download.html
echo "<h2>Main repository (future...)</h2><ul>" >> download.html
for i in `ls main|sort -r`; do
TS=`git log master/$i | grep "Date:" | head -1 | awk '{$1="";$2="";$7="";print substr($0,3,length($0)-3)}'`
if [ -z "$TS" ]; then TS=`date`; fi
echo "<li><a href=\"main/$i\">$i</a> ($TS)</li>\n" >> download.html;
done
echo "</ul>"
echo "<h2>Development repository (dev2)</h2><ul>" >> download.html
for i in `ls dev|sort -r|grep "\.bin"`; do
TS=`git log dev2/$i | grep "Date:" | head -1 | awk '{$1="";$2="";$7="";print substr($0,3,length($0)-3)}'`
if [ -z "$TS" ]; then TS=`date`; fi
VERS=`basename $i -full.bin`
CL=`cat dev2/${VERS}-changelog.txt 2>/dev/null`
echo "VERS $VERS: CL $CL"
echo "<li><a href=\"dev2/$i\">$i</a> ($TS)" >> download.html
if [ -n "${CL}" ]; then echo "<br>${CL}" >> download.html; fi
echo "</li>\n" >> download.html
done
echo "</ul>"
echo "<h2>Master repository</h2><ul>" >> download.html
for i in `ls master|sort -r`; do
TS=`git log master/$i | grep "Date:" | head -1 | awk '{$1="";$2="";$7="";print substr($0,3,length($0)-3)}'`
if [ -z "$TS" ]; then TS=`date`; fi
echo "<li><a href=\"master/$i\">$i</a> ($TS)</li>\n" >> download.html;
done
echo "</ul><h2>Development repository</h2><ul>" >> download.html
echo "</ul>"
echo "<h2>Development repository (old IDF environment)</h2><ul>" >> download.html
for i in `ls devel|sort -r|grep "\.bin"`; do
TS=`git log devel/$i | grep "Date:" | head -1 | awk '{$1="";$2="";$7="";print substr($0,3,length($0)-3)}'`
if [ -z "$TS" ]; then TS=`date`; fi
@ -55,6 +75,8 @@ commit_website_files() {
cd rdz_ttgo_sonde
mkdir -p master
mkdir -p devel
mkdir -p dev2
mkdir -p main
cp ${MYPATH}/out.bin ${BRANCH}/${VERSION}-full.bin
git add ${BRANCH}/${VERSION}-full.bin
cp ${MYPATH}/build/RX_FSK.ino.bin ${BRANCH}/update.ino.bin

View File

@ -5,13 +5,17 @@
#include <WiFi.h>
#include <WiFiUdp.h>
#include <ESPAsyncWebServer.h>
#include <SPIFFS.h>
#include <LittleFS.h>
#include <SPI.h>
#include <Update.h>
#include <ESPmDNS.h>
#include <Ticker.h>
#include "esp_heap_caps.h"
#include "soc/rtc_wdt.h"
//#include <rtc_wdt.h>
//#include "soc/timer_group_struct.h"
//#include "soc/timer_group_reg.h"
#include "src/SX1278FSK.h"
#include "src/Sonde.h"
@ -63,8 +67,8 @@ extern uint8_t pmu_irq;
const char *updateHost = "rdzsonde.mooo.com";
int updatePort = 80;
const char *updatePrefixM = "/master/";
const char *updatePrefixD = "/devel/";
const char *updatePrefixM = "/main/";
const char *updatePrefixD = "/dev/";
const char *updatePrefix = updatePrefixM;
@ -233,7 +237,7 @@ char message[10240 * 3 - 2048]; //needs to be large enough for all forms (not ch
///////////////////////// Functions for Reading / Writing QRG list from/to qrg.txt
void setupChannelList() {
File file = SPIFFS.open("/qrg.txt", "r");
File file = LittleFS.open("/qrg.txt", "r");
if (!file) {
Serial.println("There was an error opening the file '/qrg.txt' for reading");
return;
@ -323,7 +327,7 @@ const char *createQRGForm() {
const char *handleQRGPost(AsyncWebServerRequest * request) {
char label[10];
// parameters: a_i, f_1, t_i (active/frequency/type)
File file = SPIFFS.open("/qrg.txt", "w");
File file = LittleFS.open("/qrg.txt", "w");
if (!file) {
Serial.println("Error while opening '/qrg.txt' for writing");
return "Error while opening '/qrg.txt' for writing";
@ -378,7 +382,7 @@ struct {
// FIXME: For now, we don't uspport wifi networks that contain newline or null characters
// ... would require a more sophisicated file format (currently one line SSID; one line Password
void setupWifiList() {
File file = SPIFFS.open("/networks.txt", "r");
File file = LittleFS.open("/networks.txt", "r");
if (!file) {
Serial.println("There was an error opening the file '/networks.txt' for reading");
networks[0].id = "RDZsonde";
@ -447,7 +451,7 @@ const char *handleWIFIPost(AsyncWebServerRequest * request) {
char label[10];
// parameters: a_i, f_1, t_i (active/frequency/type)
#if 1
File f = SPIFFS.open("/networks.txt", "w");
File f = LittleFS.open("/networks.txt", "w");
if (!f) {
Serial.println("Error while opening '/networks.txt' for writing");
return "Error while opening '/networks.txt' for writing";
@ -571,7 +575,7 @@ const char *createLiveJson() {
void setupConfigData() {
File file = SPIFFS.open("/config.txt", "r");
File file = LittleFS.open("/config.txt", "r");
if (!file) {
Serial.println("There was an error opening the file '/config.txt' for reading");
return;
@ -757,7 +761,7 @@ const char *handleConfigPost(AsyncWebServerRequest * request) {
// parameters: a_i, f_1, t_i (active/frequency/type)
Serial.println("Handling post request");
#if 1
File f = SPIFFS.open("/config.txt", "w");
File f = LittleFS.open("/config.txt", "w");
if (!f) {
Serial.println("Error while opening '/config.txt' for writing");
return "Error while opening '/config.txt' for writing";
@ -887,7 +891,7 @@ void handleUpload(AsyncWebServerRequest * request, String filename, size_t index
static File file;
if (!index) {
Serial.printf("UploadStart: %s\n", filename.c_str());
file = SPIFFS.open("/" + filename, "w");
file = LittleFS.open("/" + filename, "w");
if (!file) {
Serial.println("There was an error opening the file '/config.txt' for reading");
}
@ -956,7 +960,7 @@ int streamEditForm(int &state, File & file, String filename, char *buffer, size_
const char *createEditForm(String filename) {
Serial.println("Creating edit form");
char *ptr = message;
File file = SPIFFS.open("/" + filename, "r");
File file = LittleFS.open("/" + filename, "r");
if (!file) {
Serial.println("There was an error opening the file '/config.txt' for reading");
return "<html><head><title>File not found</title></head><body>File not found</body></html>";
@ -1015,7 +1019,7 @@ const char *handleEditPost(AsyncWebServerRequest * request) {
Serial.println("File is empty. Not written.");
return NULL;
}
File file = SPIFFS.open("/" + filename, "w");
File file = LittleFS.open("/" + filename, "w");
if (!file) {
Serial.println("There was an error opening the file '/" + filename + "'for writing");
return "";
@ -1039,9 +1043,9 @@ const char *createUpdateForm(boolean run) {
strcat(ptr, "<p>Doing update, wait until reboot</p>");
} else {
sprintf(ptr + strlen(ptr), "<p>Currently installed: %s-%c%d</p>\n", version_id, SPIFFS_MAJOR + 'A' - 1, SPIFFS_MINOR);
strcat(ptr, "<p>Available master:: <iframe src=\"http://rdzsonde.mooo.com/master/update-info.html\" style=\"height:40px;width:400px\"></iframe><br>"
"Available devel: <iframe src=\"http://rdzsonde.mooo.com/devel/update-info.html\" style=\"height:40px;width:400px\"></iframe></p>");
strcat(ptr, "<input type=\"submit\" name=\"master\" value=\"Master-Update\"></input><br><input type=\"submit\" name=\"devel\" value=\"Devel-Update\">");
strcat(ptr, "<p>Available main: <iframe src=\"http://rdzsonde.mooo.com/main/update-info.html\" style=\"height:40px;width:400px\"></iframe><br>"
"Available devel: <iframe src=\"http://rdzsonde.mooo.com/dev/update-info.html\" style=\"height:40px;width:400px\"></iframe></p>");
strcat(ptr, "<input type=\"submit\" name=\"main\" value=\"Main-Update\"></input><br><input type=\"submit\" name=\"dev\" value=\"Devel-Update\">");
strcat(ptr, "<br><p>Note: If suffix is the same, update should work fully. If the number is different, update contains changes in the file system. A full re-flash is required to get all new features, but the update should not break anything. If the letter is different, a full re-flash is mandatory, update will not work</p>");
}
strcat(ptr, "</form></body></html>");
@ -1055,12 +1059,12 @@ const char *handleUpdatePost(AsyncWebServerRequest * request) {
for (int i = 0; i < params; i++) {
String param = request->getParam(i)->name();
Serial.println(param.c_str());
if (param.equals("devel")) {
if (param.equals("dev")) {
Serial.println("equals devel");
updatePrefix = updatePrefixD;
}
else if (param.equals("master")) {
Serial.println("equals master");
else if (param.equals("main")) {
Serial.println("equals main");
updatePrefix = updatePrefixM;
}
}
@ -1137,6 +1141,7 @@ const char *sendGPX(AsyncWebServerRequest * request) {
return message;
}
#define SPIFFS LittleFS
const char* PARAM_MESSAGE = "message";
void SetupAsyncServer() {
@ -1344,7 +1349,7 @@ const char *fetchWifiPw(const char *id) {
// on a 32bit system, and the called function has no IRAM_ATTR
// so doing it manually...
// Code adapted for 64 bits from https://www.hackersdelight.org/divcMore.pdf
int64_t IRAM_ATTR divs10(int64_t n) {
static int64_t IRAM_ATTR divs10(int64_t n) {
int64_t q, r;
n = n + (n >> 63 & 9);
q = (n >> 1) + (n >> 2);
@ -1358,18 +1363,18 @@ int64_t IRAM_ATTR divs10(int64_t n) {
// return q + (r > 9);
}
int64_t IRAM_ATTR divs1000(int64_t n) {
static int64_t IRAM_ATTR divs1000(int64_t n) {
return divs10(divs10(divs10(n)));
}
unsigned long IRAM_ATTR my_millis()
static unsigned long IRAM_ATTR my_millis()
{
return divs1000(esp_timer_get_time());
}
void checkTouchStatus();
void touchISR();
void touchISR2();
static void checkTouchStatus();
static void touchISR();
static void touchISR2();
// ISR won't work for SPI transfer, so forget about the following approach
///// Also initialized timers for sx1278 handling with interruts
@ -1448,7 +1453,7 @@ void sx1278Task(void *parameter) {
}
void IRAM_ATTR touchISR() {
static void IRAM_ATTR touchISR() {
if (!button1.isTouched) {
unsigned long now = my_millis();
if (now - button1.keydownTime < 500) button1.doublepress = 1;
@ -1458,7 +1463,7 @@ void IRAM_ATTR touchISR() {
}
}
void IRAM_ATTR touchISR2() {
static void IRAM_ATTR touchISR2() {
if (!button2.isTouched) {
unsigned long now = my_millis();
if (now - button2.keydownTime < 500) button2.doublepress = 1;
@ -1469,7 +1474,7 @@ void IRAM_ATTR touchISR2() {
}
// touchRead in ISR is also a bad idea. Now moved to Ticker task
void checkTouchButton(Button & button) {
static void checkTouchButton(Button & button) {
if (button.isTouched) {
int tmp = touchRead(button.pin & 0x7f);
Serial.printf("touch read %d: value is %d\n", button.pin & 0x7f, tmp);
@ -1503,14 +1508,14 @@ void flashLed(int ms) {
}
int doTouch = 0;
void checkTouchStatus() {
static void checkTouchStatus() {
checkTouchButton(button1);
checkTouchButton(button2);
}
unsigned long bdd1, bdd2;
static bool b1wasdown = false;
void IRAM_ATTR buttonISR() {
static void IRAM_ATTR buttonISR() {
if (digitalRead(button1.pin) == 0) { // Button down
b1wasdown = true;
unsigned long now = my_millis();
@ -1546,7 +1551,7 @@ void IRAM_ATTR buttonISR() {
}
}
void IRAM_ATTR button2ISR() {
static void IRAM_ATTR button2ISR() {
if (digitalRead(button2.pin) == 0) { // Button down
unsigned long now = my_millis();
if (now - button2.keydownTime < 500) {
@ -1669,7 +1674,7 @@ int scanI2Cdevice(void)
extern int initlevels[40];
extern xSemaphoreHandle globalLock;
extern SemaphoreHandle_t globalLock;
#ifdef ESP_MEM_DEBUG
typedef void (*esp_alloc_failed_hook_t) (size_t size, uint32_t caps, const char * function_name);
@ -1709,6 +1714,7 @@ void setup()
Serial.println(" (before setup)");
sonde.defaultConfig(); // including autoconfiguration
delay(1000);
Serial.println("Initializing SPIFFS");
// Initialize SPIFFS
if (!SPIFFS.begin(true)) {
@ -1803,6 +1809,7 @@ void setup()
setupWifiList();
Serial.printf("before disp.initFromFile... layouts is %p\n", disp.layouts);
Serial.printf("test\n");
disp.initFromFile(sonde.config.screenfile);
Serial.printf("disp.initFromFile... layouts is %p", disp.layouts);
@ -2018,7 +2025,7 @@ void loopDecoder() {
if (rdzserver.hasClient()) {
Serial.println("TCP JSON socket: new connection");
rdzclient.stop();
rdzclient = rdzserver.available();
rdzclient = rdzserver.accept();
}
if (rdzclient.available()) {
Serial.print("RDZ JSON socket: received ");
@ -2256,28 +2263,29 @@ void enableNetwork(bool enable) {
Serial.println("enableNetwork done");
}
// Events used only for debug output right now
void WiFiEvent(WiFiEvent_t event)
{
Serial.printf("[WiFi-event] event: %d\n", event);
switch (event) {
case SYSTEM_EVENT_WIFI_READY:
case ARDUINO_EVENT_WIFI_READY:
Serial.println("WiFi interface ready");
break;
case SYSTEM_EVENT_SCAN_DONE:
case ARDUINO_EVENT_WIFI_SCAN_DONE:
Serial.println("Completed scan for access points");
break;
case SYSTEM_EVENT_STA_START:
case ARDUINO_EVENT_WIFI_STA_START:
Serial.println("WiFi client started");
break;
case SYSTEM_EVENT_STA_STOP:
case ARDUINO_EVENT_WIFI_STA_STOP:
Serial.println("WiFi clients stopped");
break;
case SYSTEM_EVENT_STA_CONNECTED:
case ARDUINO_EVENT_WIFI_STA_CONNECTED:
Serial.println("Connected to access point");
break;
case SYSTEM_EVENT_STA_DISCONNECTED:
case ARDUINO_EVENT_WIFI_STA_DISCONNECTED:
Serial.println("Disconnected from WiFi access point");
if (wifi_state == WIFI_CONNECT) {
// If we get a disconnect event while waiting for connection (as I do sometimes with my FritzBox),
@ -2287,62 +2295,68 @@ void WiFiEvent(WiFiEvent_t event)
}
WiFi.mode(WIFI_MODE_NULL);
break;
case SYSTEM_EVENT_STA_AUTHMODE_CHANGE:
case ARDUINO_EVENT_WIFI_STA_AUTHMODE_CHANGE:
Serial.println("Authentication mode of access point has changed");
break;
case SYSTEM_EVENT_STA_GOT_IP:
case ARDUINO_EVENT_WIFI_STA_GOT_IP:
Serial.print("Obtained IP address: ");
Serial.println(WiFi.localIP());
break;
case SYSTEM_EVENT_STA_LOST_IP:
case ARDUINO_EVENT_WIFI_STA_LOST_IP:
Serial.println("Lost IP address and IP address is reset to 0");
break;
case SYSTEM_EVENT_STA_WPS_ER_SUCCESS:
case ARDUINO_EVENT_WPS_ER_SUCCESS:
Serial.println("WiFi Protected Setup (WPS): succeeded in enrollee mode");
break;
case SYSTEM_EVENT_STA_WPS_ER_FAILED:
case ARDUINO_EVENT_WPS_ER_FAILED:
Serial.println("WiFi Protected Setup (WPS): failed in enrollee mode");
break;
case SYSTEM_EVENT_STA_WPS_ER_TIMEOUT:
case ARDUINO_EVENT_WPS_ER_TIMEOUT:
Serial.println("WiFi Protected Setup (WPS): timeout in enrollee mode");
break;
case SYSTEM_EVENT_STA_WPS_ER_PIN:
case ARDUINO_EVENT_WPS_ER_PIN:
Serial.println("WiFi Protected Setup (WPS): pin code in enrollee mode");
break;
case SYSTEM_EVENT_AP_START:
case ARDUINO_EVENT_WIFI_AP_START:
Serial.println("WiFi access point started");
break;
case SYSTEM_EVENT_AP_STOP:
case ARDUINO_EVENT_WIFI_AP_STOP:
Serial.println("WiFi access point stopped");
break;
case SYSTEM_EVENT_AP_STACONNECTED:
case ARDUINO_EVENT_WIFI_AP_STACONNECTED:
Serial.println("Client connected");
break;
case SYSTEM_EVENT_AP_STADISCONNECTED:
case ARDUINO_EVENT_WIFI_AP_STADISCONNECTED:
Serial.println("Client disconnected");
break;
case SYSTEM_EVENT_AP_STAIPASSIGNED:
case ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED:
Serial.println("Assigned IP address to client");
break;
case SYSTEM_EVENT_AP_PROBEREQRECVED:
case ARDUINO_EVENT_WIFI_AP_PROBEREQRECVED:
Serial.println("Received probe request");
break;
case SYSTEM_EVENT_GOT_IP6:
Serial.println("IPv6 is preferred");
case ARDUINO_EVENT_WIFI_AP_GOT_IP6:
Serial.println("AP IPv6 is preferred");
break;
case SYSTEM_EVENT_ETH_START:
case ARDUINO_EVENT_WIFI_STA_GOT_IP6:
Serial.println("STA IPv6 is preferred");
break;
case ARDUINO_EVENT_ETH_GOT_IP6:
Serial.println("Ethernet IPv6 is preferred");
break;
case ARDUINO_EVENT_ETH_START:
Serial.println("Ethernet started");
break;
case SYSTEM_EVENT_ETH_STOP:
case ARDUINO_EVENT_ETH_STOP:
Serial.println("Ethernet stopped");
break;
case SYSTEM_EVENT_ETH_CONNECTED:
case ARDUINO_EVENT_ETH_CONNECTED:
Serial.println("Ethernet connected");
break;
case SYSTEM_EVENT_ETH_DISCONNECTED:
case ARDUINO_EVENT_ETH_DISCONNECTED:
Serial.println("Ethernet disconnected");
break;
case SYSTEM_EVENT_ETH_GOT_IP:
case ARDUINO_EVENT_ETH_GOT_IP:
Serial.println("Obtained IP address");
break;
default:

View File

@ -51,7 +51,7 @@
<div id="About" class="tabcontent">
<div class="tci">
%VERSION_NAME%<br>
Copyright &copy; 2019-2022 by Hansi Reiser, DL9RDZ<br>
Copyright &copy; 2019-2024 by Hansi Reiser, DL9RDZ<br>
(version %VERSION_ID%)<br><br>
<a href="/upd.html">Check for update (requires TTGO internet connection via WiFi)</a><br><br>

View File

@ -12,8 +12,8 @@ Available master: <span id="masterDiv">(...checking...)</span>
Available devel: <span id="develDiv">(...checking...)</span>
</p>
<input type="submit" name="master" value="Master-Update"></input><br>
<input type="submit" name="devel" value="Devel-Update"><br>
<input type="submit" name="main" value="Main-Update"></input><br>
<input type="submit" name="dev" value="Dev-Update"><br>
<p>Note: If suffix is the same, update should work fully. If the number is different, update contains changes in the file system. A full re-flash is required to get all new features, but the update should not break anything. If the letter is different, a full re-flash is mandatory, update will not work</p></form>
<script>
@ -21,13 +21,13 @@ const masterInfo = document.getElementById('masterDiv');
const develInfo = document.getElementById('develDiv');
let request = new XMLHttpRequest();
request.open('GET', 'http://rdzsonde.mooo.com/master/update-info.html');
request.open('GET', 'http://rdzsonde.mooo.com/main/update-info.html');
request.onload = function() {
masterInfo.innerHTML = request.response.replace(/<[^>]*>/g, '');
}
request.send();
let drequest = new XMLHttpRequest();
drequest.open('GET', 'http://rdzsonde.mooo.com/devel/update-info.html');
drequest.open('GET', 'http://rdzsonde.mooo.com/dev/update-info.html');
drequest.onload = function() {
develInfo.innerHTML= drequest.response.replace(/<[^>]*>/g, '');;
}

View File

@ -2,13 +2,14 @@
// Configuration flags for including/excluding fuctionality from the compiled binary
// set flag to 0 for exclude/1 for include
#if 1
// Selection of data output connectors to be included in firmware
// APRS includes AXUDP (e.g. for aprsmap) and APRS-IS (TCP) (e.g. for wettersonde.net, radiosondy.info)
#define FEATURE_SONDEHUB 1
#define FEATURE_CHASEMAPPER 1
#define FEATURE_MQTT 1
#define FEATURE_SDCARD 0
#define FEATURE_SDCARD 1
#define FEATURE_APRS 1
@ -26,5 +27,14 @@
* Also, it is easier to use different fonts :) just flash the font partition w/ something else...
* This option will likely be removed post-master1.0
*/
#define LEGACY_FONTS_IN_CODEBIN 1
#define LEGACY_FONTS_IN_CODEBIN 0
#else
// Safeboot image is a minimalistic version that only includes WiFi / OTA functionality
#define FEATURE_SONDEHUB 0
#define FEATURE_MQTT 0
#define FEATURE_SDARD 0
#define FEATURE_APRS 0
#define LEGACY_FONTS_IN_CODEBIN 0
#endif

View File

@ -1,8 +1,8 @@
#include "../features.h"
#include <U8x8lib.h>
#include <U8g2lib.h>
#include <SPIFFS.h>
#include <MicroNMEA.h>
#include <LittleFS.h>
#include "Display.h"
#include "Sonde.h"
#include "pmu.h"
@ -25,7 +25,7 @@ extern Sonde sonde;
extern PMU *pmu;
extern SemaphoreHandle_t axpSemaphore;
extern xSemaphoreHandle globalLock;
extern SemaphoreHandle_t globalLock;
#define SPI_MUTEX_LOCK() \
do \
{ \
@ -265,14 +265,16 @@ static const uint8_t *fl[] = {
void U8x8Display::begin() {
Serial.printf("Init SSD1306 display %d %d\n", sonde.config.oled_scl, sonde.config.oled_sda);
Serial.printf("Init SSD1306 display %d %d %d\n", sonde.config.oled_scl, sonde.config.oled_sda, sonde.config.oled_rst);
//u8x8 = new U8X8_SSD1306_128X64_NONAME_SW_I2C(/* clock=*/ sonde.config.oled_scl, /* data=*/ sonde.config.oled_sda, /* reset=*/ sonde.config.oled_rst); // Unbuffered, basic graphics, software I2C
if (_type==2) {
u8x8 = new U8X8_SH1106_128X64_NONAME_HW_I2C(/* reset=*/ sonde.config.oled_rst, /* clock=*/ sonde.config.oled_scl, /* data=*/ sonde.config.oled_sda); // Unbuffered, basic graphics, software I2C
} else { //__type==0 or anything else
u8x8 = new U8X8_SSD1306_128X64_NONAME_HW_I2C(/* reset=*/ sonde.config.oled_rst, /* clock=*/ sonde.config.oled_scl, /* data=*/ sonde.config.oled_sda); // Unbuffered, basic graphics, software I2C
}
Serial.println("calling begin..");
u8x8->begin();
Serial.println("setup finishing...");
if(sonde.config.tft_orient==3) u8x8->setFlipMode(true);
if(sonde.config.dispcontrast>=0) u8x8->setContrast(sonde.config.dispcontrast);
@ -380,7 +382,7 @@ void U8x8Display::drawQS(uint16_t x, uint16_t y, uint8_t len, uint8_t /*size*/,
}
#ifdef LEGACY_FONTS_IN_CODEBIN
#if LEGACY_FONTS_IN_CODEBIN
const GFXfont *legacygfl[] = {
&Terminal11x16Font, // 1 (replacement for 1 with old library)
&Terminal11x16Font, // 2 (replacement for 2 with old library)
@ -396,7 +398,8 @@ const GFXfont **gfl = legacygfl;
static int ngfx = sizeof(legacygfl)/sizeof(GFXfont *);
#else
// will crash if no font partition exists........
const GFXdont **gfl = NULL;
const GFXfont **gfl = NULL;
static int ngfx = 0;
#endif
@ -405,14 +408,14 @@ const GFXdont **gfl = NULL;
static void init_gfx_fonts() {
// if we have a fonts partition, relocate and use that...
const esp_partition_t *part;
spi_flash_mmap_handle_t handle;
esp_partition_mmap_handle_t handle;
void *data;
esp_err_t err;
part = esp_partition_find_first((esp_partition_type_t)0x40, ESP_PARTITION_SUBTYPE_APP_FACTORY, "fonts");
part = esp_partition_find_first(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, "fonts");
if(part) {
Serial.println("FONT partition found!");
err = esp_partition_mmap(part, 0, part->size, SPI_FLASH_MMAP_DATA, (const void **)&data, &handle);
Serial.printf("FONT partition found, size is %d!", part->size);
err = esp_partition_mmap(part, 0, part->size, ESP_PARTITION_MMAP_DATA, (const void **)&data, &handle);
if( err != ESP_OK ) {
Serial.println("mmap not OK\n");
return;
@ -424,8 +427,9 @@ static void init_gfx_fonts() {
Serial.println("No font data in font partition");
return;
}
fptr++;
int n=0;
for(const GFXfont **g=fptr; *g!=NULL; g++) n++;
for(const GFXfont **g=fptr; *g!=NULL; g++) { Serial.printf("fptr=%p *=%p\n", g, *g); n++; }
Serial.printf("There a %d fonts in the font partition\n", n);
if(n>MAXFONT) n=MAXFONT;
GFXfont **newgfl = (GFXfont **)malloc( n*sizeof(GFXfont) + MAXFONT*sizeof(GFXfont *) );
@ -438,13 +442,18 @@ static void init_gfx_fonts() {
for(int i=0; i<n; i++) {
newgfl[i] = fonts+i;
GFXfont *orig = (GFXfont *)(((char *)data) + (uint32_t)fptr[i]);
printf("data is %p, orig = %p\n", data, orig);
memcpy(newgfl[i], orig, sizeof(GFXfont));
newgfl[i]->bitmap = newgfl[i]->bitmap + (uint32_t)data; // relocate bitmap pointer to mmap partition
newgfl[i]->glyph = (GFXglyph *)( ((char *)newgfl[i]->glyph) + (uint32_t)data );
Serial.printf("font i: gfl[i] is %p, gfl[i]->bitmap is %p, gfl[i]->glyph is %p\n", newgfl[i], newgfl[i]->bitmap, newgfl[i]->glyph);
Serial.printf("font %d: gfl[i] is %p, gfl[i]->bitmap is %p, gfl[i]->glyph is %p\n", i, newgfl[i], newgfl[i]->bitmap, newgfl[i]->glyph);
Serial.printf(" font data: first=%d, last=%d, yAdv=%d\n", newgfl[i]->first, newgfl[i]->last, newgfl[i]->yAdvance);
}
gfl = (const GFXfont **)newgfl;
ngfx = n;
} else {
Serial.println("FATAL ERROR: NO FONT PARTITION FOUND\n");
while(1);
}
}
@ -1045,11 +1054,12 @@ int Display::getScreenIndex(int index) {
void Display::initFromFile(int index) {
File d;
char file[20];
printf("getting index: %d\n", index);
index = getScreenIndex(index); // auto selection for index==0
snprintf(file, 20, "/screens%d.txt", index);
Serial.printf("Reading %s\n", file);
d = SPIFFS.open(file, "r");
d = LittleFS.open(file, "r");
if(!d || d.available()==0 ) { Serial.printf("%s not found\n", file); return; }
DispInfo *newlayouts = (DispInfo *)malloc(MAXSCREENS * sizeof(DispInfo));

View File

@ -7,7 +7,7 @@
#include <SPI.h>
#include <Arduino_GFX_Library.h>
#include <U8x8lib.h>
#include <SPIFFS.h>
#include <LittleFS.h>
#include "posinfo.h"

View File

@ -5,7 +5,6 @@
#include "SX1278FSK.h"
#include "rsc.h"
#include "Sonde.h"
#include <SPIFFS.h>
#define M10M20_DEBUG 1

View File

@ -5,7 +5,6 @@
#include "SX1278FSK.h"
#include "rsc.h"
#include "Sonde.h"
#include <SPIFFS.h>
#define MP3H_DEBUG 1

View File

@ -685,6 +685,12 @@ float GetRAHumidity( uint32_t humCurrent, uint32_t humMin, uint32_t humMax, floa
return RH;
}
// ESP32 does not mind about non-aligned pointers (for reading floats from packed struct)
#pragma GCC diagnostic push
#if __GNUC__ >= 9
#pragma GCC diagnostic ignored "-Waddress-of-packed-member" <<-- This key had been introduced since GCC 9
#endif
// returns: 0: ok, -1: rs or crc error
int RS41::decode41(byte *data, int maxlen)
{

View File

@ -6,7 +6,7 @@
#include "SX1278FSK.h"
#include "rsc.h"
#include "Sonde.h"
#include <SPIFFS.h>
#include <LittleFS.h>
// well...
#include "rs92gps.h"

View File

@ -23,7 +23,7 @@
SX1278FSK::SX1278FSK() {}
void SX1278FSK::setup(xSemaphoreHandle lock)
void SX1278FSK::setup(SemaphoreHandle_t lock)
{
_lock = lock;
Serial.println("Setup sx1278");
@ -228,7 +228,7 @@ uint8_t SX1278FSK::setFSK()
//writeRegister(REG_FIFO_THRESH, 0x80); // condition to start packet tx
//config1 = readRegister(REG_SYNC_CONFIG);
//config1 = config1 & B00111111;
//config1 = config1 & 0b00111111;
//writeRegister(REG_SYNC_CONFIG,config1);
delay(100);
@ -610,7 +610,7 @@ int SX1278FSK::getMaxCurrent()
value = readRegister(REG_OCP);
// extract only the OcpTrim value from the OCP register
value &= B00011111;
value &= 0b00011111;
if( value <= 15 ) {
value = (45 + (5 * value));
@ -665,7 +665,7 @@ int8_t SX1278FSK::setMaxCurrent(uint8_t rate)
else
{
// Enable Over Current Protection
rate |= B00100000;
rate |= 0b00100000;
//state = 1;
st0 = readRegister(REG_OP_MODE); // Save the previous status
@ -882,5 +882,5 @@ void SX1278FSK::showRxRegisters()
}
#endif
xSemaphoreHandle globalLock =xSemaphoreCreateMutex();
SemaphoreHandle_t globalLock =xSemaphoreCreateMutex();
SX1278FSK sx1278 = SX1278FSK();

View File

@ -171,7 +171,7 @@ public:
// class constructor
SX1278FSK();
void setup(xSemaphoreHandle lock);
void setup(SemaphoreHandle_t lock);
// Turn on SX1278 module (return 0 on sucess, 1 otherwise)
uint8_t ON();
@ -256,7 +256,7 @@ public:
// Receive a packet
uint8_t receivePacketTimeout(uint32_t wait, byte *data);
xSemaphoreHandle _lock = NULL;
SemaphoreHandle_t _lock = NULL;
#if 0
//! It gets the internal temperature of the module.

View File

@ -104,7 +104,8 @@ void Sonde::defaultConfig() {
config.sx1278_miso = MISO;
config.sx1278_mosi = MOSI;
config.sx1278_sck = SCK;
config.oled_rst = 16;
// config.oled_rst = 16;
config.oled_rst = -1; // GPIO16 is Flash CS on Lora32 v1.6
config.disptype = 0;
config.dispcontrast = -1;
config.tft_orient = 1;
@ -115,11 +116,16 @@ void Sonde::defaultConfig() {
if(initlevels[16]==0) {
config.oled_sda = 4;
config.oled_scl = 15;
config.oled_rst = 16;
config.button_pin = 0;
config.button2_pin = T4 + 128; // T4 == GPIO13
config.power_pout = 21; // for Heltec v2
config.led_pout = 2;
Serial.println("Autoconfig: looks like TTGO v1 / Heltec v1/V2 board");
// Note: binary image compiled for other boards (40 MHz crystal) will no longer work for v1 board (26 MHz crystal)
// -- serial speed is wrong (staring arduino-idf 3.0.4), and WiFi also is partially broken.
// So if using that old board, you need to recompile specifically for the 26 MHz.
} else {
config.oled_sda = 21;
config.oled_scl = 22;

View File

@ -148,7 +148,7 @@ extern int aprsstr_mon2raw(const char *mon, char raw[], int raw_len)
uint32_t n;
uint32_t i;
uint32_t tmp;
int p = 7L;
int32_t p = 7L;
i = 0UL;
fprintf(stderr,"mon2raw for %s\n", mon);
if (!mkaprscall(&p, raw, &i, mon, '>', 0, 0, 48UL)) {

View File

@ -115,7 +115,7 @@ void ConnAPRS::updateStation( PosInfo *pi ) {
// We check for new connections or new data (tnc port)
if (!tncclient.connected()) {
tncclient = tncserver.available();
tncclient = tncserver.accept();
if (tncclient.connected()) {
Serial.println("new TCP KISS connection");
}

View File

@ -18,6 +18,10 @@ void ConnSDCard::netsetup() {
/* empty function, we don't use any network here */
}
String ConnSDCard::getStatus() {
return String("");
}
void ConnSDCard::updateSonde( SondeInfo *si ) {
if (!initok) return;
if (!file) {

View File

@ -30,6 +30,7 @@ public:
/* Called approx 1x / second* */
virtual void updateStation( PosInfo *pi );
String getStatus();
private:
File file;

View File

@ -23,8 +23,8 @@ typedef struct
{
uint8_t *bitmap; ///< Glyph bitmaps, concatenated
GFXglyph *glyph; ///< Glyph array
uint8_t first; ///< ASCII extents (first char)
uint8_t last; ///< ASCII extents (last char)
uint16_t first; ///< ASCII extents (first char)
uint16_t last; ///< ASCII extents (last char)
uint8_t yAdvance; ///< Newline distance (y axis)
} GFXfont;

View File

@ -3,9 +3,9 @@
#include "time.h"
#include "geteph.h"
#include <SPIFFS.h>
#include <LittleFS.h>
#include <WiFi.h>
#include <rom/miniz.h>
#include <miniz.h>
#include <inttypes.h>
#include <WiFi.h>
#include "Display.h"
@ -67,7 +67,7 @@ void geteph() {
Serial.printf("year %d, day %d\n", year, day);
char nowstr[20];
snprintf(nowstr, 20, "%04d%03d%02d", year, day, tinfo.tm_hour);
File status = SPIFFS.open("/brdc.time", "r");
File status = LittleFS.open("/brdc.time", "r");
if(status) {
String ts = status.readStringUntil('\n');
const char *tsstr = ts.c_str();
@ -81,7 +81,7 @@ void geteph() {
Serial.printf("now: %s, existing: %s => updating\n", nowstr, tsstr);
}
status.close();
File fh = SPIFFS.open("/brdc.gz","w");
File fh = LittleFS.open("/brdc.gz","w");
if(!fh) {
Serial.println("cannot open file\n");
return;
@ -168,12 +168,12 @@ void geteph() {
// decompression
tinfl_decompressor *decomp = (tinfl_decompressor *)malloc(sizeof(tinfl_decompressor));
tinfl_init(decomp);
File file = SPIFFS.open("/brdc.gz","r");
File file = LittleFS.open("/brdc.gz","r");
if(!file) {
Serial.println("cannot open file\n");
return;
}
File ofile = SPIFFS.open("/brdc", "w");
File ofile = LittleFS.open("/brdc", "w");
if(!ofile) {
Serial.println("cannot open file /brdc for writing");
return;
@ -227,7 +227,7 @@ void geteph() {
}
// maybe todo: check crc?!?
Serial.printf("done extracing content (total length: %d)\n", total);
status = SPIFFS.open("/brdc.time","w");
status = LittleFS.open("/brdc.time","w");
status.println(nowstr);
status.close();
snprintf(buf, 16, "Done: %d B ",total);

View File

@ -1,26 +0,0 @@
// SPDX-License-Identifier: GPL-3.0
// original source: https://github.com/Nkawu/TFT_22_ILI9225
// Font structures like Adafruit_GFX (1.1 and later).
// Example fonts are included in 'fonts' directory.
// To use a font in your Arduino sketch, #include the corresponding .h
// file and pass address of GFXfont struct to setFont().
#ifndef _GFFFONT_H_
#define _GFFFONT_H_
typedef struct { // Data stored PER GLYPH
uint16_t bitmapOffset; // Pointer into GFXfont->bitmap
uint8_t width, height; // Bitmap dimensions in pixels
uint8_t xAdvance; // Distance to advance cursor (x axis)
int8_t xOffset, yOffset; // Dist from cursor pos to UL corner
} GFXglyph;
typedef struct { // Data stored for FONT AS A WHOLE:
uint8_t *bitmap; // Glyph bitmaps, concatenated
GFXglyph *glyph; // Glyph array
uint8_t first, last; // ASCII extents
uint8_t yAdvance; // Newline distance (y axis)
} GFXfont;
#endif // _GFFFONT_H_

View File

@ -12,7 +12,7 @@
*/
#include <math.h>
#include <inttypes.h>
#include <SPIFFS.h>
#include <LittleFS.h>
#include <Arduino.h>
#include <stdio.h>
@ -106,7 +106,7 @@ EPHEM_t *read_RNXpephs(const char *file) {
int c;
EPHEM_t ephem = {};
File fp = SPIFFS.open(file, "r");
File fp = LittleFS.open(file, "r");
if(!fp) { Serial.printf("Error opening %s\n", file); }
String line;

View File

@ -19,9 +19,9 @@ public:
uint16_t readRegisters_8_4(uint8_t reghi, uint8_t reglo);
uint16_t readRegisters_8_5(uint8_t reghi, uint8_t reglo);
int writeRegister(uint8_t reg, uint8_t val);
int getRegisterBit(uint8_t register, uint8_t bit);
int setRegisterBit(uint8_t register, uint8_t bit);
int clearRegisterBit(uint8_t register, uint8_t bit);
int getRegisterBit(uint8_t reg, uint8_t bit);
int setRegisterBit(uint8_t reg, uint8_t bit);
int clearRegisterBit(uint8_t reg, uint8_t bit);
int handleIRQ();

View File

@ -1,5 +1,7 @@
#include "posinfo.h"
#include <FS.h>
#include <LittleFS.h>
#include <MicroNMEA.h>
@ -171,7 +173,7 @@ void dumpGPS() {
void initGPS() {
if (sonde.config.gps_rxd < 0) return; // GPS disabled
if (sonde.config.gps_txd >= 0) { // TX enable, thus try setting baud to 9600 and do a factory reset
File testfile = SPIFFS.open("/GPSRESET", FILE_READ);
File testfile = LittleFS.open("/GPSRESET", FILE_READ);
if (testfile && !testfile.isDirectory()) {
testfile.close();
Serial.println("GPS resetting baud to 9k6...");
@ -209,7 +211,7 @@ void initGPS() {
dumpGPS();
delay(1000);
dumpGPS();
SPIFFS.remove("/GPSRESET");
LittleFS.remove("/GPSRESET");
} else if (testfile) {
Serial.println("GPS reset file: not found/isdir");
testfile.close();

View File

@ -4,7 +4,6 @@
#include <inttypes.h>
#include "Sonde.h"
#include <SPIFFS.h>
enum { SH_LOC_OFF, SH_LOC_FIXED, SH_LOC_CHASE, SH_LOC_AUTO };

View File

@ -50,7 +50,6 @@
#include <math.h>
#include <stdint.h>
#include <SPIFFS.h>
#include "nav_gps_vel.h"
#include "rs92gps.h"
#include "geteph.h"

View File

@ -1,4 +1,4 @@
const char *version_name = "rdzTTGOsonde";
const char *version_id = "devel20240530";
const int SPIFFS_MAJOR=2;
const int SPIFFS_MINOR=17;
const char *version_id = "dev20240812";
const int SPIFFS_MAJOR=3;
const int SPIFFS_MINOR=0;

9
partitions-rdz.csv Normal file
View File

@ -0,0 +1,9 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x140000,
app1, app, ota_1, 0x150000,0x140000,
# intentional gap... app1 can be increased to up to 1c0000 (1792k) if needed (or more by shrinking app0)
fonts, data,undefined,0x310000,0x10000,
spiffs, data, spiffs, 0x320000,0xD0000,
coredump, data, coredump,0x3F0000,0x10000,
1 # Name, Type, SubType, Offset, Size, Flags
2 nvs, data, nvs, 0x9000, 0x5000,
3 otadata, data, ota, 0xe000, 0x2000,
4 app0, app, ota_0, 0x10000, 0x140000,
5 app1, app, ota_1, 0x150000,0x140000,
6 # intentional gap... app1 can be increased to up to 1c0000 (1792k) if needed (or more by shrinking app0)
7 fonts, data,undefined,0x310000,0x10000,
8 spiffs, data, spiffs, 0x320000,0xD0000,
9 coredump, data, coredump,0x3F0000,0x10000,

View File

@ -16,19 +16,23 @@ data_dir = RX_FSK/data
lib_deps_builtin =
; src
lib_deps_external =
olikraus/U8g2 @ ^2.35.8
#olikraus/U8g2 @ ^2.35.8
olikraus/U8g2
stevemarple/MicroNMEA @ ^2.0.5
https://github.com/me-no-dev/ESPAsyncWebServer/archive/refs/heads/master.zip
https://github.com/moononournation/Arduino_GFX#v1.2.9
https://github.com/me-no-dev/AsyncTCP
https://github.com/me-no-dev/ESPAsyncWebServer.git
# https://github.com/me-no-dev/ESPAsyncWebServer/archive/refs/heads/master.zip
https://github.com/moononournation/Arduino_GFX
https://github.com/dx168b/async-mqtt-client
[env:ttgo-lora32]
# Issues with 6.4.0 (TCP corruption) and 6.5.0 (no DHCP response from AP) need to be investigated before upgrading further.
#platform = https://github.com/platformio/platform-espressif32.git#v6.3.0
# for now, stick to 3.3.2 for compatibility with travis Arduino builds (partition table, maybe watchdog issue?)
platform = https://github.com/platformio/platform-espressif32.git#v3.3.2
# PlatformIO currently has no direct support for Arduino-ISP 3.0.4
# There is a modified version from tasmota that supports that... let's use this (this also saves some code space)
platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.08.10/platform-espressif32.zip
board = ttgo-lora32-v1
; board = heltec_wifi_lora_32
board = ttgo-lora32-v21
board_build.filesystem = littlefs
framework = arduino
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
@ -37,8 +41,9 @@ lib_deps =
${extra.lib_deps_external}
paulstoffregen/Time@^1.6.0
lib_ignore = Time
; Same as with ArduinoIDE. Saves around 27k code
build_flags = -DCORE_DEBUG_LEVEL=0
; build_flags = -DCORE_DEBUG_LEVEL=0
; Add / remove the following two lines for separate fonts partition in flash
; after changes:
@ -48,9 +53,6 @@ build_flags = -DCORE_DEBUG_LEVEL=0
; - pio run --target=uploadfonts (uploads fonts.bin created during the first pio run)
; Then everything should be "back to normal"
;
extra_scripts = post:scripts/makefontpartition.py
;board_build.partitions = partition-fonts.csv
; Uncomment the following if you want to have the partition scheme used in the ESP32 board version 2.0.x of ArduinoIDE
; board_build.partitions = partitions-esp32v2.csv
extra_scripts = scripts/pio-build-extension.py
board_build.partitions = partitions-rdz.csv

View File

@ -1,15 +1,61 @@
#!/usr/bin/env python3
Import("env")
env.AddPostAction(
"$BUILD_DIR/${PROGNAME}.elf",
print("Current CLI targets", COMMAND_LINE_TARGETS)
print("Current Build targets", BUILD_TARGETS)
def post_program_action(source, target, env):
print("Program has been built!")
program_path = target[0].get_abspath()
print("Program path", program_path)
# Use case: sign a firmware, do any manipulations with ELF, etc
# env.Execute(f"sign --elf {program_path}")
env.AddPostAction("$PROGPATH", post_program_action)
def tst(source, target, env):
print("tst")
# Build file system manually
def build_parts(source, target, env):
target_fsbin = env.DataToBin(join("$BUILD_DIR", "${ESP32_FS_IMAGE_NAME}"), "$PROJECT_DATA_DIR")
env.noCache(target_fsbin)
AlwaysBuild(target_fsbin)
def generate_image(source, target, env):
print("!!! Building images...")
build_parts(source, target, env)
# default target is elf file (if not target buildfs or uploadfs on command line)
# so this target will build elf file, then next build fonts and file system
env.AddCustomTarget(
"firmware",
"$BUILD_DIR/$(PROGNAME}.elf",
generate_image)
env.AddCustomTarget(
"buildfonts",
"$BUILD_DIR/$(PROGNAME}.elf",
env.VerboseAction(" ".join([
"xtensa-esp32-elf-ld", "-T", "fontlink.ld", "--oformat=binary", "-o", "$BUILD_DIR/fonts.bin", "$BUILD_DIR/src/src/fonts/fonts.cpp.o" ]),
"Building $BUILD_DIR/fonts.bin")
)
"Building $BUILD_DIR/fonts.bin"))
env.AddCustomTarget(
"uploadfonts",
"$BUILD_DIR/fonts.bin",
"buildfonts",
"scripts/uploadfonts.py $BUILD_DIR/fonts.bin $PARTITIONS_TABLE_CSV"
)
env.AddCustomTarget(
"uploadall",
"firmware",
tst)
dict = env.Dictionary()
keys = dict.keys()
for key in keys:
print ("construction variable = '%s', value = '%s'" % (key, dict[key]))

43
scripts/pio-build-extension.py Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/env python3
from os.path import join
Import("env")
print("Current CLI targets", COMMAND_LINE_TARGETS)
print("Current Build targets", BUILD_TARGETS)
def post_program_action(source, target, env):
print("Program has been built!")
program_path = target[0].get_abspath()
print("Program path", program_path)
# Use case: sign a firmware, do any manipulations with ELF, etc
# env.Execute(f"sign --elf {program_path}")
# env.AddPostAction("$PROGPATH", post_program_action)
print("PROGPATH is $PROGPATH")
def tst(source, target, env):
print("tst")
# We generate all parts, using post actions or dependencies. Now merge all to a firmware bin file....
def generate_image(source, target, env):
env.Execute("esptool.py --chip esp32 merge_bin -o $BUILD_DIR/firmware-image.bin --flash_mode dio --flash_size 4MB 0x1000 $BUILD_DIR/bootloader.bin 0x8000 $BUILD_DIR/partitions.bin 0x10000 $BUILD_DIR/firmware.bin 0x310000 $BUILD_DIR/fonts.bin 0x320000 $BUILD_DIR/littlefs.bin --target-offset 0x1000")
# default target is elf file (if not target buildfs or uploadfs on command line)
# so this target will build elf file and file system bin as dependency
# Also, as a post actino for the elf file, we generate fonts.bin
target_fsbin = env.DataToBin(join("$BUILD_DIR", "${ESP32_FS_IMAGE_NAME}"), "$PROJECT_DATA_DIR")
env.AddCustomTarget(
"firmware",
["$BUILD_DIR/${PROGNAME}.bin", target_fsbin],
generate_image)
# After generating the elf file, generate fonts.bin as well
env.AddPostAction("$PROGPATH",
env.VerboseAction(" ".join([
"xtensa-esp32-elf-ld", "-T", "fontlink.ld", "--oformat=binary", "-o", "$BUILD_DIR/fonts.bin", "$BUILD_DIR/src/src/fonts/fonts.cpp.o" ]),
"Building $BUILD_DIR/fonts.bin"))

View File

@ -102,7 +102,7 @@ def getpartinfo(partname):
import gen_esp32part as pt
# flash complete file system
# automatically get file system parameters from ESP (i.e. you need to program the partition table first)
if False:
if True:
tmpdir = tempfile.mkdtemp()
partbin = os.path.join(tmpdir, "partition.bin")
sys._argv = sys.argv[:]

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python3.11
import requests
import sys
import os
@ -18,6 +18,7 @@ SIZE=-1
# Fetch font partition info
file = open(partition, "r")
for line in file:
print(line)
if line.startswith("fonts"):
l = line.split(",")
OFFSET = l[3]
@ -29,5 +30,5 @@ for line in file:
print("Using offset ",OFFSET,"; size is ",SIZE)
sys._argv = sys.argv[:]
sys.argv=[sys._argv[0],"--chip", "esp32", "--baud", "921600", "--before", "default_reset", "--after", "hard_reset", "write_flash", "-z", "--flash_mode", "dio", "--flash_freq", "80m", "--flash_size", "detect", OFFSET, ".pio/build/ttgo-lora32/fonts.bin"]
sys.argv=[sys._argv[0],"--chip", "esp32", "--baud", "921600", "--before", "default_reset", "--after", "hard_reset", "write_flash", "-z", "--flash_mode", "dio", "--flash_freq", "80m", "--flash_size", "detect", str(OFFSET), ".pio/build/ttgo-lora32/fonts.bin"]
esptool.main()