diff --git a/.travis.yml b/.travis.yml index d7ce010..b9fe29b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,8 +47,7 @@ script: - arduino --board esp32:esp32:t-beam --verify $PWD/RX_FSK/RX_FSK.ino - find build - find /home/travis/.arduino15/packages/esp32/hardware/esp32/ - - $MKSPIFFS -c $PWD/RX_FSK/data -b 4096 -p 256 -s 1503232 $PWD/spiffs.bin - - $PWD/scripts/makeimage.py $ESP32TOOLS $PWD/build/RX_FSK.ino.bin $PWD/spiffs.bin $PWD/out.bin + - $PWD/scripts/makeimage.py $ESP32TOOLS $PWD/build/RX_FSK.ino.bin $PWD/RX_FSK/data $PWD/out.bin after_success: - .travis/push.sh notifications: diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino index cf7b283..4816666 100644 --- a/RX_FSK/RX_FSK.ino +++ b/RX_FSK/RX_FSK.ino @@ -431,6 +431,7 @@ struct st_configitems config_list[] = { {"oled_rst", "OLED RST/TFT RST (needs reboot)", 0, &sonde.config.oled_rst}, {"tft_rs", "TFT RS", 0, &sonde.config.tft_rs}, {"tft_cs", "TFT CS", 0, &sonde.config.tft_cs}, + {"tft_orient", "TFT orientation (0/1/2/3)", 0, &sonde.config.tft_orient}, {"button_pin", "Button input port", -4, &sonde.config.button_pin}, {"button2_pin", "Button 2 input port", -4, &sonde.config.button2_pin}, {"touch_thresh", "Touch button threshold", 0, &sonde.config.touch_thresh}, diff --git a/RX_FSK/data/config.txt b/RX_FSK/data/config.txt index 2ce548a..7805ad7 100644 --- a/RX_FSK/data/config.txt +++ b/RX_FSK/data/config.txt @@ -23,6 +23,7 @@ led_pout=9 #oled_rst=16 #tft_rs=2 #tft_cs=0 +tft_orient=1 #gps_rxd=-1 gps_txd=-1 #-------------------------------# diff --git a/RX_FSK/version.h b/RX_FSK/version.h index e5902f4..f8df69e 100644 --- a/RX_FSK/version.h +++ b/RX_FSK/version.h @@ -1,2 +1,2 @@ const char *version_name = "rdzTTGOsonde"; -const char *version_id = "devel20191026"; +const char *version_id = "devel20191027"; diff --git a/libraries/SondeLib/Display.cpp b/libraries/SondeLib/Display.cpp index 9e08967..b39c77a 100644 --- a/libraries/SondeLib/Display.cpp +++ b/libraries/SondeLib/Display.cpp @@ -318,7 +318,7 @@ void ILI9225Display::begin() { tft = new MY_ILI9225(sonde.config.oled_rst, sonde.config.tft_rs, sonde.config.tft_cs, sonde.config.oled_sda, sonde.config.oled_scl, TFT_LED, TFT_BRIGHTNESS); tft->begin(spiDisp); - tft->setOrientation(1); + tft->setOrientation(sonde.config.tft_orient); } void ILI9225Display::clear() { diff --git a/libraries/SondeLib/Sonde.cpp b/libraries/SondeLib/Sonde.cpp index b6a5f0d..c7aaaa0 100644 --- a/libraries/SondeLib/Sonde.cpp +++ b/libraries/SondeLib/Sonde.cpp @@ -75,6 +75,7 @@ void Sonde::defaultConfig() { config.gps_txd = -1; config.oled_rst = 16; config.disptype = 0; + config.tft_orient = 1; if(initlevels[16]==0) { config.oled_sda = 4; config.oled_scl = 15; @@ -89,7 +90,7 @@ void Sonde::defaultConfig() { if(initlevels[12]==0) { // T-Beam v1.0 Serial.println("Autoconfig: looks like T-Beam 1.0 board"); config.button_pin = 38; - config.button2_pin = -1; //T4 + 128; // T4 = GPIO13 + config.button2_pin = 15 + 128; //T4 + 128; // T4 = GPIO13 config.gps_rxd = 34; // Check for I2C-Display@21,22 #define SSD1306_ADDRESS 0x3c @@ -213,6 +214,8 @@ void Sonde::setConfig(const char *cfg) { config.tft_rs = atoi(val); } else if(strcmp(cfg,"tft_cs")==0) { config.tft_cs = atoi(val); + } else if(strcmp(cfg,"tft_orient")==0) { + config.tft_orient = atoi(val); } else if(strcmp(cfg,"gps_rxd")==0) { config.gps_rxd = atoi(val); } else if(strcmp(cfg,"gps_txd")==0) { diff --git a/libraries/SondeLib/Sonde.h b/libraries/SondeLib/Sonde.h index 1e3b2a4..6e50c9e 100644 --- a/libraries/SondeLib/Sonde.h +++ b/libraries/SondeLib/Sonde.h @@ -96,6 +96,7 @@ typedef struct st_rdzconfig { int oled_rst; // OLED/TFT reset pin int tft_rs; // TFT RS pin int tft_cs; // TFT CS pin + int tft_orient; // TFT orientation (default: 1) int gps_rxd; // GPS module RXD pin. We expect 9600 baud NMEA data. int gps_txd; // GPS module TXD pin // software configuration diff --git a/scripts/makeimage.py b/scripts/makeimage.py index ff16205..a713c30 100755 --- a/scripts/makeimage.py +++ b/scripts/makeimage.py @@ -1,20 +1,62 @@ #!/usr/bin/python +import os import sys +import csv +import subprocess + +#default.csv content: +#nvs, data, nvs, 0x9000, 0x5000, +#otadata, data, ota, 0xe000, 0x2000, +#app0, app, ota_0, 0x10000, 0x140000, +#app1, app, ota_1, 0x150000,0x140000, +#spiffs, data, spiffs, 0x290000,0x170000, + +MKSPIFFS = os.environ['MKSPIFFS'] +print "mkspiffs is "+MKSPIFFS OFFSET_BOOTLOADER = 0x1000 OFFSET_PARTITIONS = 0x8000 + +## now taken from default.csv OFFSET_BOOTAPP0 = 0xE000 OFFSET_APPLICATION = 0x10000 OFFSET_SPIFFS = 0x291000 +SIZE_SPIFFS = 0x16F000 esp32tools = sys.argv[1] file_in = sys.argv[2] -file_spiffs = sys.argv[3] +data_dir = sys.argv[3] file_out = sys.argv[4] +partition = esp32tools + "/partitions/default.csv" +with open(partition, 'rb') as csvfile: + partreader = csv.reader(csvfile, delimiter=',') + for row in partreader: + if row[0] == "otadata": + OFFSET_BOOTAPP0 = int(row[3],16) + if row[0] == "app0": + OFFSET_APPLICATION = int(row[3],16) + if row[0] == "spiffs": + OFFSET_SPIFFS = int(row[3],16) + SIZE_SPIFFS = int(row[4],16) + +print "bootapp0: "+hex(OFFSET_BOOTAPP0) +print "app0: "+hex(OFFSET_APPLICATION) +print "spiffs: "+hex(OFFSET_SPIFFS)+" size "+hex(SIZE_SPIFFS) + +# create binary partition +file_part = "/tmp/partition.bin" +partproc = subprocess.Popen(['python', esp32tools+'/gen_esp32part.py', partition, file_part]); +partproc.wait(); + +# create SPI file system +file_spiffs = "/tmp/spiffs.bin" +spiproc = subprocess.Popen([MKSPIFFS,'-c',data_dir,'-b','4096','-p','256','-s',str(SIZE_SPIFFS),file_spiffs]); +spiproc.wait(); + files_in = [ ('bootloader', OFFSET_BOOTLOADER, esp32tools+"/sdk/bin/bootloader_dio_80m.bin"), - ('partitions', OFFSET_PARTITIONS, esp32tools+"/partitions/default.bin"), + ('partitions', OFFSET_PARTITIONS, file_part), ('bootapp0', OFFSET_BOOTAPP0, esp32tools+"/partitions/boot_app0.bin"), ('application', OFFSET_APPLICATION, file_in), ('spiffs', OFFSET_SPIFFS, file_spiffs),