Compare commits

...

13 Commits

Author SHA1 Message Date
c4c946a83d Broke HTTP_Method out into a separate library for reuse in ESPAsyncWebServer (#1562) 2018-07-02 18:24:08 +02:00
3967beb4fb Added WiPy 3.0 board (#1572) 2018-07-02 18:23:06 +02:00
6411ac4e3c Remove confusing Debug output. (#1574)
If Core Debug Level is at DEBUG, a confusing debug message will be emitted if the I2C transaction takes longer complete than the  calculated minimum time.  This original debug message was just to prove that this new i2c code could correctly handle SCL stretching or interrupt latency issues. This delay is not a problem, or an error.  Usually it is caused by a higher priory interrupt starving the i2c ISR.  Usually WiFi is the culprit.  As long of this delay is within the configured timeout (by default 50ms, or can be set with Wire.setTimeOut(milliseconds);) no problem will occur and the transaction will successfully complete.
Chuck.
2018-07-02 18:22:05 +02:00
184bb069f2 Fix io16 io17 and PSRAM support (#1564)
* Add PSRAM init and malloc funtions

* Rebuild IDF libs
2018-06-30 23:06:50 +02:00
b855eb23a7 * arduino-esp32 release mgmt. update (#1557) 2018-06-29 00:54:26 +02:00
eb4e891344 Update build.sh 2018-06-28 23:45:52 +02:00
47421b869f Added OTAWebupdated (#1544)
* added OTAWebUpdater

* added OTAWebUpdater

* Updated OTAWebUpdater
2018-06-28 21:19:22 +02:00
a8ccbd40a4 Update esptool to be compatible with the packager (#1554) 2018-06-28 21:07:59 +02:00
58bdebc565 * release deployment comprehensive update (#1548) 2018-06-28 13:58:01 +02:00
ed953a0d2e BluetoothSerial: check return value and return number of bytes written (#1538) 2018-06-27 23:00:31 +02:00
93566a4fad fix PR tests 2018-06-27 22:21:13 +02:00
873876d94c Fix peek, read and available logic in WiFiClientSecure 2018-06-27 22:09:21 +02:00
058645264c Adjust RAM size and calculator 2018-06-27 21:01:31 +02:00
61 changed files with 698 additions and 211 deletions

View File

@ -9,6 +9,7 @@ set(CORE_SRCS
cores/esp32/esp32-hal-ledc.c
cores/esp32/esp32-hal-matrix.c
cores/esp32/esp32-hal-misc.c
cores/esp32/esp32-hal-psram.c
cores/esp32/esp32-hal-sigmadelta.c
cores/esp32/esp32-hal-spi.c
cores/esp32/esp32-hal-time.c

View File

@ -11,7 +11,7 @@ esp32.name=ESP32 Dev Module
esp32.upload.tool=esptool
esp32.upload.maximum_size=1310720
esp32.upload.maximum_data_size=294912
esp32.upload.maximum_data_size=327680
esp32.upload.wait_for_upload_port=true
esp32.serial.disableDTR=true
@ -98,7 +98,7 @@ pico32.name=ESP32 Pico Kit
pico32.upload.tool=esptool
pico32.upload.maximum_size=1310720
pico32.upload.maximum_data_size=294912
pico32.upload.maximum_data_size=327680
pico32.upload.wait_for_upload_port=true
pico32.serial.disableDTR=true
@ -150,7 +150,7 @@ esp32thing.name=SparkFun ESP32 Thing
esp32thing.upload.tool=esptool
esp32thing.upload.maximum_size=1310720
esp32thing.upload.maximum_data_size=294912
esp32thing.upload.maximum_data_size=327680
esp32thing.upload.wait_for_upload_port=true
esp32thing.serial.disableDTR=true
@ -193,7 +193,7 @@ nina_w10.name=u-blox NINA-W10 series (ESP32)
nina_w10.upload.tool=esptool
nina_w10.upload.maximum_size=1310720
nina_w10.upload.maximum_data_size=294912
nina_w10.upload.maximum_data_size=327680
nina_w10.upload.wait_for_upload_port=true
nina_w10.serial.disableDTR=true
@ -231,7 +231,7 @@ widora-air.name=Widora AIR
widora-air.upload.tool=esptool
widora-air.upload.maximum_size=1310720
widora-air.upload.maximum_data_size=294912
widora-air.upload.maximum_data_size=327680
widora-air.upload.wait_for_upload_port=true
widora-air.serial.disableDTR=true
@ -274,7 +274,7 @@ esp320.name=Electronic SweetPeas - ESP320
esp320.upload.tool=esptool
esp320.upload.maximum_size=1310720
esp320.upload.maximum_data_size=294912
esp320.upload.maximum_data_size=327680
esp320.upload.wait_for_upload_port=true
esp320.serial.disableDTR=true
@ -317,7 +317,7 @@ nano32.name=Nano32
nano32.upload.tool=esptool
nano32.upload.maximum_size=1310720
nano32.upload.maximum_data_size=294912
nano32.upload.maximum_data_size=327680
nano32.upload.wait_for_upload_port=true
nano32.serial.disableDTR=true
@ -360,7 +360,7 @@ lolin32.name=WEMOS LOLIN32
lolin32.upload.tool=esptool
lolin32.upload.maximum_size=1310720
lolin32.upload.maximum_data_size=294912
lolin32.upload.maximum_data_size=327680
lolin32.upload.wait_for_upload_port=true
lolin32.serial.disableDTR=true
@ -412,7 +412,7 @@ pocket_32.name=Dongsen Tech Pocket 32
pocket_32.upload.tool=esptool
pocket_32.upload.maximum_size=1310720
pocket_32.upload.maximum_data_size=294912
pocket_32.upload.maximum_data_size=327680
pocket_32.upload.wait_for_upload_port=true
pocket_32.serial.disableDTR=true
@ -455,7 +455,7 @@ WeMosBat.name="WeMos" WiFi&Bluetooth Battery
WeMosBat.upload.tool=esptool
WeMosBat.upload.maximum_size=1310720
WeMosBat.upload.maximum_data_size=294912
WeMosBat.upload.maximum_data_size=327680
WeMosBat.upload.wait_for_upload_port=true
WeMosBat.serial.disableDTR=true
@ -511,7 +511,7 @@ espea32.name=ESPea32
espea32.upload.tool=esptool
espea32.upload.maximum_size=1310720
espea32.upload.maximum_data_size=294912
espea32.upload.maximum_data_size=327680
espea32.upload.wait_for_upload_port=true
espea32.serial.disableDTR=true
@ -554,7 +554,7 @@ quantum.name=Noduino Quantum
quantum.upload.tool=esptool
quantum.upload.maximum_size=1310720
quantum.upload.maximum_data_size=294912
quantum.upload.maximum_data_size=327680
quantum.upload.wait_for_upload_port=true
quantum.serial.disableDTR=true
@ -597,7 +597,7 @@ node32s.name=Node32s
node32s.upload.tool=esptool
node32s.upload.maximum_size=1310720
node32s.upload.maximum_data_size=294912
node32s.upload.maximum_data_size=327680
node32s.upload.wait_for_upload_port=true
node32s.serial.disableDTR=true
@ -640,7 +640,7 @@ hornbill32dev.name=Hornbill ESP32 Dev
hornbill32dev.upload.tool=esptool
hornbill32dev.upload.maximum_size=1310720
hornbill32dev.upload.maximum_data_size=294912
hornbill32dev.upload.maximum_data_size=327680
hornbill32dev.upload.wait_for_upload_port=true
hornbill32dev.serial.disableDTR=true
@ -683,7 +683,7 @@ hornbill32minima.name=Hornbill ESP32 Minima
hornbill32minima.upload.tool=esptool
hornbill32minima.upload.maximum_size=1310720
hornbill32minima.upload.maximum_data_size=294912
hornbill32minima.upload.maximum_data_size=327680
hornbill32minima.upload.wait_for_upload_port=true
hornbill32minima.serial.disableDTR=true
@ -725,7 +725,7 @@ firebeetle32.name=FireBeetle-ESP32
firebeetle32.upload.tool=esptool
firebeetle32.upload.maximum_size=1310720
firebeetle32.upload.maximum_data_size=294912
firebeetle32.upload.maximum_data_size=327680
firebeetle32.upload.wait_for_upload_port=true
firebeetle32.serial.disableDTR=true
@ -768,7 +768,7 @@ intorobot-fig.name=IntoRobot Fig
intorobot-fig.upload.tool=esptool
intorobot-fig.upload.maximum_size=1310720
intorobot-fig.upload.maximum_data_size=294912
intorobot-fig.upload.maximum_data_size=327680
intorobot-fig.upload.wait_for_upload_port=true
intorobot-fig.serial.disableDTR=true
@ -811,7 +811,7 @@ onehorse32dev.name=Onehorse ESP32 Dev Module
onehorse32dev.upload.tool=esptool
onehorse32dev.upload.maximum_size=1310720
onehorse32dev.upload.maximum_data_size=294912
onehorse32dev.upload.maximum_data_size=327680
onehorse32dev.upload.wait_for_upload_port=true
onehorse32dev.serial.disableDTR=true
@ -854,7 +854,7 @@ featheresp32.name=Adafruit ESP32 Feather
featheresp32.upload.tool=esptool
featheresp32.upload.maximum_size=1310720
featheresp32.upload.maximum_data_size=294912
featheresp32.upload.maximum_data_size=327680
featheresp32.upload.wait_for_upload_port=true
featheresp32.serial.disableDTR=true
@ -910,7 +910,7 @@ nodemcu-32s.name=NodeMCU-32S
nodemcu-32s.upload.tool=esptool
nodemcu-32s.upload.maximum_size=1310720
nodemcu-32s.upload.maximum_data_size=294912
nodemcu-32s.upload.maximum_data_size=327680
nodemcu-32s.upload.wait_for_upload_port=true
nodemcu-32s.serial.disableDTR=true
@ -953,7 +953,7 @@ mhetesp32devkit.name=MH ET LIVE ESP32DevKIT
mhetesp32devkit.upload.tool=esptool
mhetesp32devkit.upload.maximum_size=1310720
mhetesp32devkit.upload.maximum_data_size=294912
mhetesp32devkit.upload.maximum_data_size=327680
mhetesp32devkit.upload.wait_for_upload_port=true
mhetesp32devkit.serial.disableDTR=true
@ -1018,7 +1018,7 @@ mhetesp32minikit.name=MH ET LIVE ESP32MiniKit
mhetesp32minikit.upload.tool=esptool
mhetesp32minikit.upload.maximum_size=1310720
mhetesp32minikit.upload.maximum_data_size=294912
mhetesp32minikit.upload.maximum_data_size=327680
mhetesp32minikit.upload.wait_for_upload_port=true
mhetesp32minikit.serial.disableDTR=true
@ -1083,7 +1083,7 @@ esp32vn-iot-uno.name=ESP32vn IoT Uno
esp32vn-iot-uno.upload.tool=esptool
esp32vn-iot-uno.upload.maximum_size=1310720
esp32vn-iot-uno.upload.maximum_data_size=294912
esp32vn-iot-uno.upload.maximum_data_size=327680
esp32vn-iot-uno.upload.wait_for_upload_port=true
esp32vn-iot-uno.serial.disableDTR=true
@ -1126,7 +1126,7 @@ esp32doit-devkit-v1.name=DOIT ESP32 DEVKIT V1
esp32doit-devkit-v1.upload.tool=esptool
esp32doit-devkit-v1.upload.maximum_size=1310720
esp32doit-devkit-v1.upload.maximum_data_size=294912
esp32doit-devkit-v1.upload.maximum_data_size=327680
esp32doit-devkit-v1.upload.wait_for_upload_port=true
esp32doit-devkit-v1.serial.disableDTR=true
@ -1180,7 +1180,7 @@ esp32-evb.name=OLIMEX ESP32-EVB
esp32-evb.upload.tool=esptool
esp32-evb.upload.maximum_size=1310720
esp32-evb.upload.maximum_data_size=294912
esp32-evb.upload.maximum_data_size=327680
esp32-evb.upload.wait_for_upload_port=true
esp32-evb.serial.disableDTR=true
@ -1212,7 +1212,7 @@ esp32-gateway.name=OLIMEX ESP32-GATEWAY
esp32-gateway.upload.tool=esptool
esp32-gateway.upload.maximum_size=1310720
esp32-gateway.upload.maximum_data_size=294912
esp32-gateway.upload.maximum_data_size=327680
esp32-gateway.upload.wait_for_upload_port=true
esp32-gateway.serial.disableDTR=true
@ -1244,7 +1244,7 @@ espino32.name=ThaiEasyElec's ESPino32
espino32.upload.tool=esptool
espino32.upload.maximum_size=1310720
espino32.upload.maximum_data_size=294912
espino32.upload.maximum_data_size=327680
espino32.upload.wait_for_upload_port=true
espino32.serial.disableDTR=true
@ -1287,7 +1287,7 @@ m5stack-core-esp32.name=M5Stack-Core-ESP32
m5stack-core-esp32.upload.tool=esptool
m5stack-core-esp32.upload.maximum_size=1310720
m5stack-core-esp32.upload.maximum_data_size=294912
m5stack-core-esp32.upload.maximum_data_size=327680
m5stack-core-esp32.upload.wait_for_upload_port=true
m5stack-core-esp32.serial.disableDTR=true
@ -1365,7 +1365,7 @@ odroid_esp32.name=ODROID ESP32
odroid_esp32.upload.tool=esptool
odroid_esp32.upload.maximum_size=1310720
odroid_esp32.upload.maximum_data_size=294912
odroid_esp32.upload.maximum_data_size=327680
odroid_esp32.upload.wait_for_upload_port=true
odroid_esp32.serial.disableDTR=true
@ -1443,7 +1443,7 @@ heltec_wifi_kit_32.name=Heltec_WIFI_Kit_32
heltec_wifi_kit_32.upload.tool=esptool
heltec_wifi_kit_32.upload.maximum_size=1310720
heltec_wifi_kit_32.upload.maximum_data_size=294912
heltec_wifi_kit_32.upload.maximum_data_size=327680
heltec_wifi_kit_32.upload.wait_for_upload_port=true
heltec_wifi_kit_32.serial.disableDTR=true
@ -1486,7 +1486,7 @@ heltec_wifi_lora_32.name=Heltec_WIFI_LoRa_32
heltec_wifi_lora_32.upload.tool=esptool
heltec_wifi_lora_32.upload.maximum_size=1310720
heltec_wifi_lora_32.upload.maximum_data_size=294912
heltec_wifi_lora_32.upload.maximum_data_size=327680
heltec_wifi_lora_32.upload.wait_for_upload_port=true
heltec_wifi_lora_32.serial.disableDTR=true
@ -1529,7 +1529,7 @@ espectro32.name=ESPectro32
espectro32.upload.tool=esptool
espectro32.upload.maximum_size=1310720
espectro32.upload.maximum_data_size=294912
espectro32.upload.maximum_data_size=327680
espectro32.upload.wait_for_upload_port=true
espectro32.serial.disableDTR=true
@ -1604,7 +1604,7 @@ CoreESP32.name=Microduino-CoreESP32
CoreESP32.upload.tool=esptool
CoreESP32.upload.maximum_size=1310720
CoreESP32.upload.maximum_data_size=294912
CoreESP32.upload.maximum_data_size=327680
CoreESP32.upload.wait_for_upload_port=true
CoreESP32.serial.disableDTR=true
@ -1640,3 +1640,60 @@ CoreESP32.menu.UploadSpeed.460800.macosx=460800
CoreESP32.menu.UploadSpeed.460800.upload.speed=460800
CoreESP32.menu.UploadSpeed.512000.windows=512000
CoreESP32.menu.UploadSpeed.512000.upload.speed=512000
##############################################################
wipy3.name=WiPy 3.0
wipy3.upload.tool=esptool
wipy3.upload.maximum_size=1310720
wipy3.upload.maximum_data_size=294912
wipy3.upload.wait_for_upload_port=true
wipy3.serial.disableDTR=true
wipy3.serial.disableRTS=true
wipy3.build.mcu=esp32
wipy3.build.core=esp32
wipy3.build.variant=wipy3
wipy3.build.board=WIPY3
wipy3.build.f_cpu=240000000L
wipy3.build.flash_mode=dio
wipy3.build.flash_size=8MB
wipy3.build.boot=dio
wipy3.build.partitions=default
wipy3.menu.FlashFreq.80=80MHz
wipy3.menu.FlashFreq.80.build.flash_freq=80m
wipy3.menu.FlashFreq.40=40MHz
wipy3.menu.FlashFreq.40.build.flash_freq=40m
wipy3.menu.UploadSpeed.921600=921600
wipy3.menu.UploadSpeed.921600.upload.speed=921600
wipy3.menu.UploadSpeed.115200=115200
wipy3.menu.UploadSpeed.115200.upload.speed=115200
wipy3.menu.UploadSpeed.256000.windows=256000
wipy3.menu.UploadSpeed.256000.upload.speed=256000
wipy3.menu.UploadSpeed.230400.windows.upload.speed=256000
wipy3.menu.UploadSpeed.230400=230400
wipy3.menu.UploadSpeed.230400.upload.speed=230400
wipy3.menu.UploadSpeed.460800.linux=460800
wipy3.menu.UploadSpeed.460800.macosx=460800
wipy3.menu.UploadSpeed.460800.upload.speed=460800
wipy3.menu.UploadSpeed.512000.windows=512000
wipy3.menu.UploadSpeed.512000.upload.speed=512000
wipy3.menu.DebugLevel.none=None
wipy3.menu.DebugLevel.none.build.code_debug=0
wipy3.menu.DebugLevel.error=Error
wipy3.menu.DebugLevel.error.build.code_debug=1
wipy3.menu.DebugLevel.warn=Warn
wipy3.menu.DebugLevel.warn.build.code_debug=2
wipy3.menu.DebugLevel.info=Info
wipy3.menu.DebugLevel.info.build.code_debug=3
wipy3.menu.DebugLevel.debug=Debug
wipy3.menu.DebugLevel.debug.build.code_debug=4
wipy3.menu.DebugLevel.verbose=Verbose
wipy3.menu.DebugLevel.verbose.build.code_debug=5

View File

@ -990,15 +990,6 @@ i2c_err_t i2cProcQueue(i2c_t * i2c, uint32_t *readCount, uint16_t timeOutMillis)
}
if(eBits&EVENT_DONE) { // no gross timeout
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
uint32_t expected =(totalBytes*10*1000)/i2cGetFrequency(i2c);
if((tAfter-tBefore)>(expected+1)) { //used some of the timeout Period
// expected can be zero due to small packets
log_e("TimeoutRecovery: expected=%ums, actual=%ums",expected,(tAfter-tBefore));
i2cDumpI2c(i2c);
i2cDumpInts(i2c->num);
}
#endif
switch(i2c->error) {
case I2C_OK :
reason = I2C_ERROR_OK;

View File

@ -84,6 +84,9 @@ bool btInUse(){ return false; }
void initArduino()
{
#if CONFIG_SPIRAM_SUPPORT
psramInit();
#endif
esp_log_level_set("*", CONFIG_LOG_DEFAULT_LEVEL);
esp_err_t err = nvs_flash_init();
if(err == ESP_ERR_NVS_NO_FREE_PAGES){

View File

@ -0,0 +1,99 @@
#include "esp32-hal.h"
#include "sdkconfig.h"
#if CONFIG_SPIRAM_SUPPORT
#include "esp_spiram.h"
#include "soc/efuse_reg.h"
#include "esp_heap_caps.h"
static volatile bool spiramDetected = false;
static volatile bool spiramFailed = false;
bool psramInit(){
if (spiramDetected) {
return true;
}
#ifndef CONFIG_SPIRAM_BOOT_INIT
if (spiramFailed) {
return false;
}
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
uint32_t pkg_ver = chip_ver & 0x7;
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) {
spiramFailed = true;
log_w("PSRAM not supported!");
return false;
}
esp_spiram_init_cache();
if (esp_spiram_init() != ESP_OK) {
spiramFailed = true;
log_w("PSRAM init failed!");
pinMatrixOutDetach(16, false, false);
pinMatrixOutDetach(17, false, false);
return false;
}
if (!esp_spiram_test()) {
spiramFailed = true;
log_e("PSRAM test failed!");
return false;
}
if (esp_spiram_add_to_heapalloc() != ESP_OK) {
spiramFailed = true;
log_e("PSRAM could not be added to the heap!");
return false;
}
#endif
spiramDetected = true;
log_d("PSRAM enabled");
return true;
}
bool IRAM_ATTR psramFound(){
return spiramDetected;
}
void IRAM_ATTR *ps_malloc(size_t size){
if(!spiramDetected){
return NULL;
}
return heap_caps_malloc(size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
}
void IRAM_ATTR *ps_calloc(size_t n, size_t size){
if(!spiramDetected){
return NULL;
}
return heap_caps_calloc(n, size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
}
void IRAM_ATTR *ps_realloc(void *ptr, size_t size){
if(!spiramDetected){
return NULL;
}
return heap_caps_realloc(ptr, size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
}
#else
bool psramInit(){
return false;
}
bool IRAM_ATTR psramFound(){
return false;
}
void IRAM_ATTR *ps_malloc(size_t size){
return NULL;
}
void IRAM_ATTR *ps_calloc(size_t n, size_t size){
return NULL;
}
void IRAM_ATTR *ps_realloc(void *ptr, size_t size){
return NULL;
}
#endif

View File

@ -0,0 +1,25 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _ESP32_HAL_PSRAM_H_
#define _ESP32_HAL_PSRAM_H_
bool psramInit();
bool psramFound();
void *ps_malloc(size_t size);
void *ps_calloc(size_t n, size_t size);
void *ps_realloc(void *ptr, size_t size);
#endif /* _ESP32_HAL_PSRAM_H_ */

View File

@ -59,6 +59,7 @@ void yield(void);
#include "esp32-hal-sigmadelta.h"
#include "esp32-hal-timer.h"
#include "esp32-hal-bt.h"
#include "esp32-hal-psram.h"
#include "esp_system.h"
//returns chip temperature in Celsius

View File

@ -0,0 +1,160 @@
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <ESPmDNS.h>
#include <Update.h>
const char* host = "ESP32";
const char* ssid = "xxx";
const char* password = "xxxx";
WebServer server(80);
const char* loginIndex = "<form name='loginForm'>"
"<table width='20%' bgcolor='A09F9F' align='center'>"
"<tr>"
"<td colspan=2><center><font size=4><b>ESP32 Login Page</b></font></center>"
"<br>"
"</td>"
"<br>"
"<br>"
"</tr>"
"<td>Username:</td>"
"<td><input type='text' size=25 name='userid'><br></td>"
"</tr>"
"<br>"
"<br>"
"<tr>"
"<td>Password:</td>"
"<td><input type='Password' size=25 name='pwd'><br></td>"
"<br>"
"<br>"
"</tr>"
"<tr>"
"<td><input type='submit' onclick='check(this.form)' value='Login'></td>"
"</tr>"
"</table>"
"</form>"
"<script>"
"function check(form)"
"{"
"if(form.userid.value=='admin' && form.pwd.value=='admin')"
"{"
"window.open('/serverIndex')"
"}"
"else"
"{"
" alert('Error Password or Username')/*displays error message*/"
"}"
"}"
"</script>";
const char* serverIndex = "<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>"
"<form method='POST' action='#' enctype='multipart/form-data' id='upload_form'>"
"<input type='file' name='update'>"
"<input type='submit' value='Update'>"
"</form>"
"<div id='prg'>progress: 0%</div>"
"<script>"
"$('form').submit(function(e){"
"e.preventDefault();"
"var form = $('#upload_form')[0];"
"var data = new FormData(form);"
" $.ajax({"
"url: '/update',"
"type: 'POST',"
"data: data,"
"contentType: false,"
"processData:false,"
"xhr: function() {"
"var xhr = new window.XMLHttpRequest();"
"xhr.upload.addEventListener('progress', function(evt) {"
"if (evt.lengthComputable) {"
"var per = evt.loaded / evt.total;"
"$('#prg').html('progress: ' + Math.round(per*100) + '%');"
"}"
"}, false);"
"return xhr;"
"},"
"success:function(d, s) {"
"console.log('success!')"
"},"
"error: function (a, b, c) {"
"}"
"});"
"});"
"</script>";
void setup(void) {
Serial.begin(115200);
// Connect to WiFi network
WiFi.begin(ssid, password);
Serial.println("");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
/*use mdns for host name resolution*/
if (!MDNS.begin(host)) { //http://esp32.local
Serial.println("Error setting up MDNS responder!");
while (1) {
delay(1000);
}
}
Serial.println("mDNS responder started");
/*return index page which is stored in serverIndex */
server.on("/", HTTP_GET, []() {
server.sendHeader("Connection", "close");
server.send(200, "text/html", loginIndex);
});
server.on("/serverIndex", HTTP_GET, []() {
server.sendHeader("Connection", "close");
server.send(200, "text/html", serverIndex);
});
/*handling uploading firmware file */
server.on("/update", HTTP_POST, []() {
server.sendHeader("Connection", "close");
server.send(200, "text/plain", (Update.hasError()) ? "FAIL" : "OK");
ESP.restart();
}, []() {
HTTPUpload& upload = server.upload();
if (upload.status == UPLOAD_FILE_START) {
Serial.printf("Update: %s\n", upload.filename.c_str());
if (!Update.begin(UPDATE_SIZE_UNKNOWN)) { //start with max available size
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_WRITE) {
/* flashing firmware to ESP*/
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_END) {
if (Update.end(true)) { //true to set the size to the current progress
Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize);
} else {
Update.printError(Serial);
}
}
});
server.begin();
}
void loop(void) {
server.handleClient();
delay(1);
}

View File

@ -220,21 +220,24 @@ int BluetoothSerial::read(void)
size_t BluetoothSerial::write(uint8_t c)
{
if (_spp_client){
uint8_t buffer[1];
buffer[0] = c;
esp_spp_write(_spp_client, 1, buffer);
return 1;
if (!_spp_client){
return 0;
}
return -1;
uint8_t buffer[1];
buffer[0] = c;
esp_err_t err = esp_spp_write(_spp_client, 1, buffer);
return (err == ESP_OK) ? 1 : 0;
}
size_t BluetoothSerial::write(const uint8_t *buffer, size_t size)
{
if (_spp_client){
esp_spp_write(_spp_client, size, (uint8_t *)buffer);
if (!_spp_client){
return 0;
}
return size;
esp_err_t err = esp_spp_write(_spp_client, size, (uint8_t *)buffer);
return (err == ESP_OK) ? size : 0;
}
void BluetoothSerial::flush()

View File

@ -0,0 +1,15 @@
#ifndef _HTTP_Method_H_
#define _HTTP_Method_H_
typedef enum {
HTTP_GET = 0b00000001,
HTTP_POST = 0b00000010,
HTTP_DELETE = 0b00000100,
HTTP_PUT = 0b00001000,
HTTP_PATCH = 0b00010000,
HTTP_HEAD = 0b00100000,
HTTP_OPTIONS = 0b01000000,
HTTP_ANY = 0b01111111,
} HTTPMethod;
#endif /* _HTTP_Method_H_ */

View File

@ -27,8 +27,8 @@
#include <functional>
#include <memory>
#include <WiFi.h>
#include "HTTP_Method.h"
enum HTTPMethod { HTTP_ANY, HTTP_GET, HTTP_POST, HTTP_PUT, HTTP_PATCH, HTTP_DELETE, HTTP_OPTIONS };
enum HTTPUploadStatus { UPLOAD_FILE_START, UPLOAD_FILE_WRITE, UPLOAD_FILE_END,
UPLOAD_FILE_ABORTED };
enum HTTPClientStatus { HC_NONE, HC_WAIT_READ, HC_WAIT_CLOSE };

View File

@ -81,6 +81,7 @@ void WiFiClientSecure::stop()
close(sslclient->socket);
sslclient->socket = -1;
_connected = false;
_peek = -1;
}
stop_ssl_socket(sslclient, _CA_cert, _cert, _private_key);
}
@ -105,7 +106,7 @@ int WiFiClientSecure::connect(const char *host, uint16_t port, const char *_CA_c
int ret = start_ssl_client(sslclient, host, port, _CA_cert, _cert, _private_key);
_lastError = ret;
if (ret < 0) {
log_e("lwip_connect_r: %d", errno);
log_e("start_ssl_client: %d", ret);
stop();
return 0;
}
@ -117,7 +118,7 @@ int WiFiClientSecure::peek(){
if(_peek >= 0){
return _peek;
}
_peek = read();
_peek = timedRead();
return _peek;
}
@ -158,21 +159,30 @@ size_t WiFiClientSecure::write(const uint8_t *buf, size_t size)
int WiFiClientSecure::read(uint8_t *buf, size_t size)
{
if(_peek >= 0){
uint8_t data = -1;
data = _peek;
_peek = -1;
return data;
}
if (!available()) {
int peeked = 0;
if ((!buf && size) || (_peek < 0 && !available())) {
return -1;
}
if(!size){
return 0;
}
if(_peek >= 0){
buf[0] = _peek;
_peek = -1;
size--;
if(!size || !available()){
return 1;
}
buf++;
peeked = 1;
}
int res = get_ssl_receive(sslclient, buf, size);
if (res < 0) {
stop();
return res;
}
return res;
return res + peeked;
}
int WiFiClientSecure::available()
@ -183,7 +193,9 @@ int WiFiClientSecure::available()
int res = data_to_read(sslclient);
if (res < 0 ) {
stop();
}
} else if(_peek >= 0) {
res += 1;
}
return res;
}

View File

@ -38,7 +38,7 @@
{
"packager": "esp32",
"name": "esptool",
"version": "da31d9d"
"version": "da31d9d2"
},
{
"packager": "esp32",
@ -85,21 +85,42 @@
},
{
"name": "esptool",
"version": "da31d9d",
"version": "da31d9d2",
"systems": [
{
"host": "i686-mingw32",
"url": "https://dl.espressif.com/dl/esptool-da31d9d-windows.zip",
"archiveFileName": "esptool-da31d9d-windows.zip",
"checksum": "SHA-256:6476f4d6e33a59167dea364e177d97167316253d2c9ac75f81b469ecb3ed3875",
"size": "3395925"
"url": "https://dl.espressif.com/dl/esptool-da31d9d2-windows.zip",
"archiveFileName": "esptool-da31d9d2-windows.zip",
"checksum": "SHA-256:5e3b5154b9adaf38aeb580222b434bf6e9381a8b989e227f3ad6b2cecc56a57b",
"size": "3396085"
},
{
"host": "x86_64-apple-darwin",
"url": "https://dl.espressif.com/dl/esptool-da31d9d-macos.tar.gz",
"archiveFileName": "esptool-da31d9d-macos.tar.gz",
"checksum": "SHA-256:76d53298366a294235356bb8d197a81b2afbfd62642851bfbaee252cc593faa9",
"size": "3810904"
"url": "https://dl.espressif.com/dl/esptool-da31d9d2-macos.tar.gz",
"archiveFileName": "esptool-da31d9d2-macos.tar.gz",
"checksum": "SHA-256:00f2c16e3b44064596e883fcb20392c9e52ebf74484672170fbeb4c6641e37cc",
"size": "3810936"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "https://dl.espressif.com/dl/esptool-da31d9d2-linux.tar.gz",
"archiveFileName": "esptool-da31d9d2-linux.tar.gz",
"checksum": "SHA-256:a8a23028bde25b25fae39554b4e6138592ef18e099bfeb239b4a003a2ae3f55c",
"size": "39563"
},
{
"host": "i686-pc-linux-gnu",
"url": "https://dl.espressif.com/dl/esptool-da31d9d2-linux.tar.gz",
"archiveFileName": "esptool-da31d9d2-linux.tar.gz",
"checksum": "SHA-256:a8a23028bde25b25fae39554b4e6138592ef18e099bfeb239b4a003a2ae3f55c",
"size": "39563"
},
{
"host": "arm-linux-gnueabihf",
"url": "https://dl.espressif.com/dl/esptool-da31d9d2-linux.tar.gz",
"archiveFileName": "esptool-da31d9d2-linux.tar.gz",
"checksum": "SHA-256:a8a23028bde25b25fae39554b4e6138592ef18e099bfeb239b4a003a2ae3f55c",
"size": "39563"
}
]
},

View File

@ -3,7 +3,7 @@ version=0.0.1
runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf
tools.esptool.path={runtime.platform.path}/tools
tools.esptool.path={runtime.platform.path}/tools/esptool
tools.esptool.cmd=esptool
tools.esptool.cmd.linux=esptool.py
tools.esptool.cmd.windows=esptool.exe
@ -88,8 +88,8 @@ recipe.output.save_file={build.project_name}.{build.variant}.bin
## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=^(?:\.iram0\.text|\.dram0\.text|\.flash\.text|\.dram0\.data|\.flash\.rodata|)\s+([0-9]+).*
recipe.size.regex.data=^(?:\.dram0\.data|\.dram0\.bss)\s+([0-9]+).*
recipe.size.regex=^(?:\.iram0\.text|\.iram0\.vectors|\.dram0\.data|\.flash\.text|\.flash\.rodata|)\s+([0-9]+).*
recipe.size.regex.data=^(?:\.dram0\.data|\.dram0\.bss|\.noinit)\s+([0-9]+).*
# ------------------------------

View File

@ -5,15 +5,16 @@
# $2 - JSON output file
function downloadAndMergePackageJSON()
{
echo " --- Package JSON definition merge BEGIN ---"
echo
echo " ---Package JSON definition merge BEGIN--->"
jsonLink=$1
jsonOut=$2
curlAuthToken=$3
outDirectory=$4
echo "Remote package JSON: $jsonLink (source)"
echo "Current package JSON: $jsonOut (target)"
echo " - remote package JSON: $jsonLink (source)"
echo " - current package JSON: $jsonOut (target)"
old_json=$outDirectory/oldJson.json
merged_json=$outDirectory/mergedJson.json
@ -22,7 +23,7 @@ function downloadAndMergePackageJSON()
#echo " Local tmp for remote JSON: $old_json"
#echo " Merge output JSON: $merged_json"
echo "Downloading JSON package definition: $jsonLink ..."
echo " - downloading JSON package definition: $jsonLink ..."
# Authentication through HTTP headers might fail on redirection due to bug in cURL (https://curl.haxx.se/docs/adv_2018-b3bf.html - headers are resent to the target location including the original authentication)
# Notes:
@ -38,7 +39,7 @@ function downloadAndMergePackageJSON()
#curl -L -o "$old_json" "$jsonLink"
echo "Merging $old_json into $jsonOut ..."
echo " - merging $old_json into $jsonOut ..."
echo
set +e
@ -49,16 +50,17 @@ function downloadAndMergePackageJSON()
set -v
if [ ! -s $merged_json ]; then
rm -f "$merged_json"
echo "Nothing to merge ($merged_json empty), $jsonOut unchanged"
echo " Done: nothing to merge ($merged_json empty) => $jsonOut remains unchanged"
else
rm -f "$jsonOut"
mv "$merged_json" "$jsonOut"
echo "Data successfully merged to $jsonOut"
echo " Done: JSON data successfully merged to $jsonOut"
fi
rm -f "$old_json"
set +v
echo " --- Package JSON definition merge END ---"
echo " <---Package JSON definition merge END---"
echo
}
############################################################
@ -73,58 +75,65 @@ echo "==================================================================="
echo "RELEASE PACKAGE PUBLISHING ARRANGEMENTS (GitHub/Arduino compliance)"
echo "==================================================================="
echo
cmdLine=`basename $0 $@`
echo "Cmdline: ${cmdLine}"
# cURL authentication token
while getopts ":a:,:d:" opt; do
case $opt in
a)
curlAuth=$OPTARG
echo "ACCESS TOKEN: $curlAuth" >&2
#echo " ACCESS TOKEN: $curlAuth" >&2
;;
d)
releaseDir=$OPTARG
echo "RELEASE OUTPUT DIRECTORY: $releaseDir" >&2
#echo " RELEASE OUTPUT DIRECTORY: $releaseDir" >&2
;;
\?)
echo "Invalid option: -$OPTARG" >&2
echo "Error: invalid option -$OPTARG => aborting" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
echo "Error: option -$OPTARG requires an argument => aborting" >&2
exit 1
;;
esac
done
# where we at?
echo
echo "Prequisite check:"
if [ -z "$TRAVIS_BUILD_DIR" ]; then
echo "Non-TravisCI environment"
echo " - non-TravisCI environment"
cd "$( dirname ${BASH_SOURCE[0]} )"/..
bTravisRun=0
else
echo "TravisCI run"
echo " - TravisCI run"
cd $TRAVIS_BUILD_DIR
bTravisRun=1
fi
# no tag, no love
if [ -z "$TRAVIS_TAG" ] && [ $bTravisRun -eq 1 ]; then
echo "Non-tagged builds not supported in Travis CI environment, exiting"
echo "Warning: non-tagged builds not supported in Travis CI environment => exiting"
exit 0
fi
currentDir=`pwd`
echo "Current working directory: $currentDir"
echo
echo "Package build settings:"
echo "======================="
srcdir=$currentDir
# source directory
srcdir=`pwd`
echo "Current working directory: ${srcdir}"
# target directory for actual release fileset
if [ -z "$releaseDir" ]; then
releaseDir=release
fi
echo "Release output directory: $releaseDir"
# get current branch name and commit hash
# Git versions, branch names, tags
branch_name=""
verx=""
extent=""
@ -132,15 +141,18 @@ extent=""
if [ -z "$TRAVIS_TAG" ]; then
branch_name=`git rev-parse --abbrev-ref HEAD 2>/dev/null`
ver=`sed -n -E 's/version=([0-9.]+)/\1/p' platform.txt`
verx=`git rev-parse --short=8 HEAD 2>/dev/null`
else
ver=$TRAVIS_TAG
fi
verx=`git rev-parse --short=8 HEAD 2>/dev/null`
# Package name resolving (case-insensitive):
# - unknown branch, master branch or branch in detached state (HEAD revision) use only the tag's name as version string (esp32-$TAG_NAME, eg 'esp32-1.0.0-RC1')
# - all other branches use long-version string (esp32-$BRANCH_NAME-$GITREV_NUMBER_SHORT, eg 'esp32-idf_update-cde668da')
# Package name (case-insensitive)
shopt -s nocasematch
if [ ! -z "$branch_name" ] && [ "$branch_name" != "master" ]; then
if [ ! -z "$branch_name" ] && [ "$branch_name" != "master" ] && [ "$branch_name" != "head" ]; then
extent="-$branch_name-$verx"
fi
@ -148,54 +160,56 @@ package_name=esp32-$ver$extent
shopt -u nocasematch
echo "Version: $ver"
echo "Branch name: $branch_name"
echo "Git revision (8B): $verx"
echo "Extension: $extent"
echo "Package version: $ver"
echo "Git branch name: $branch_name"
echo "Git revision number: $verx"
echo "Package name extension: $extent"
echo "Travis CI tag: $TRAVIS_TAG"
echo "Package name: $package_name"
echo "Release package name: $package_name"
# Set REMOTE_URL environment variable to the address where the package will be
# available for download. This gets written into package json file.
if [ -z "$REMOTE_URL" ]; then
REMOTE_URL="http://localhost:8000"
echo "REMOTE_URL not defined, using default"
remoteEchoOut="${REMOTE_URL} (REMOTE_URL variable not defined, using default)"
else
remoteEchoOut="${REMOTE_URL}"
fi
echo "Remote: $REMOTE_URL"
echo "Target URL for download (JSON incl): ${remoteEchoOut}"
# Create directory for the package
outdir=$releaseDir/$package_name
echo "Temporary output directory: $outdir"
echo "Local temp directory: $outdir"
rm -rf $releaseDir
mkdir -p $outdir
# Copy package required stuff:
# Copy files required for the package release:
echo
echo "Package build processing:"
echo "========================="
echo
echo "Prepare files for the package main archive:"
echo " - copying neccessary files from current Git repository..."
# <package root>
# <PACKAGE ROOT>
cp -f $srcdir/boards.txt $outdir/
cp -f $srcdir/platform.txt $outdir/
cp -f $srcdir/programmers.txt $outdir/
# <complete dirs>
# <COMPLETE DIRS>
# cores/
# libraries/
# variants/
# tools/partitions/
cp -Rf $srcdir/cores $outdir/
cp -Rf $srcdir/libraries $outdir/
cp -Rf $srcdir/variants $outdir/
mkdir -p $outdir/tools
cp -Rf $srcdir/tools/partitions $outdir/tools/
# <dir & files>
# tools/partitions/
mkdir -p $outdir/tools/partitions
cp -f $srcdir/tools/partitions/boot_app0.bin $outdir/tools/partitions
cp -f $srcdir/tools/partitions/default.csv $outdir/tools/partitions
cp -f $srcdir/tools/partitions/minimal.csv $outdir/tools/partitions
cp -f $srcdir/tools/partitions/min_spiffs.csv $outdir/tools/partitions
cp -f $srcdir/tools/partitions/no_ota.csv $outdir/tools/partitions
# <DIR & FILES>
# tools/sdk/
cp -Rf $srcdir/tools/sdk $outdir/tools/
@ -206,50 +220,53 @@ cp -f $srcdir/tools/esptool.py $outdir/tools/
cp -f $srcdir/tools/gen_esp32part.py $outdir/tools/
cp -f $srcdir/tools/gen_esp32part.exe $outdir/tools/
echo " - cleaning *.DS_Store files..."
find $outdir -name '*.DS_Store' -exec rm -f {} \;
# Do some replacements in platform.txt file, which are required because IDE
# handles tool paths differently when package is installed in hardware folder
echo " - updating platform.txt..."
cat $srcdir/platform.txt | \
sed 's/runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32-elf//g' | \
sed 's/tools.esptool.path={runtime.platform.path}\/tools\/esptool/tools.esptool.path=\{runtime.tools.esptool.path\}/g' \
> $outdir/platform.txt
# Put core version and short hash of git version into core_version.h
ver_define=`echo $plain_ver | tr "[:lower:].\055" "[:upper:]_"`
echo Ver define: $ver_define
echo \#define ARDUINO_ESP32_GIT_VER 0x`git rev-parse --short=8 HEAD 2>/dev/null` >$outdir/cores/esp32/core_version.h
ver_define=`echo $ver | tr "[:lower:].\055" "[:upper:]_"`
echo " - generating C/C++ header defines ($ver_define -> /cores/esp32/core_version.h)..."
echo \#define ARDUINO_ESP32_GIT_VER 0x$verx >$outdir/cores/esp32/core_version.h
echo \#define ARDUINO_ESP32_GIT_DESC `git describe --tags 2>/dev/null` >>$outdir/cores/esp32/core_version.h
echo \#define ARDUINO_ESP32_RELEASE_$ver_define >>$outdir/cores/esp32/core_version.h
echo \#define ARDUINO_ESP32_RELEASE \"$ver_define\" >>$outdir/cores/esp32/core_version.h
# Store submodules' current versions
echo " - getting submodule list (${releaseDir}/submodules.txt)..."
git submodule status > $releaseDir/submodules.txt
# remove all .git* files
echo " - removing *.git files possibly fetched to package tempdir..."
find $outdir -name '*.git*' -type f -delete
# Zip the package
package_name_zip=$package_name.zip
echo "----------------------------------------------------------"
echo "Making $package_name ZIP archive..."
echo
echo " - creating package ZIP archive (${package_name_zip})..."
pushd $releaseDir >/dev/null
zip -qr $package_name_zip $package_name
if [ $? -ne 0 ]; then
echo " !error: failed to create ${package_name_zip} (ZIP errno: $?) => aborting"
exit 1
fi
echo "----------------------------------------------------------"
echo "Making $package_name JSON definition file(s)..."
echo
# Calculate SHA sum and size
# Calculate SHA sum and size of ZIP archive
sha=`shasum -a 256 $package_name_zip | cut -f 1 -d ' '`
size=`/bin/ls -l $package_name_zip | awk '{print $5}'`
echo Size: $size
echo SHA-256: $sha
echo " ${package_name_zip} creation OK (size: $size, sha2: $sha)"
echo
echo "Making $package_name JSON definition file(s):"
popd >/dev/null
@ -261,20 +278,46 @@ shopt -s nocasematch
if [[ $TRAVIS_TAG == *-RC* ]]; then
bIsPrerelease=1
package_name_json=$PACKAGE_JSON_DEV
echo "Package type: PRE-RELEASE, JSON def.file: $PACKAGE_JSON_DEV"
echo " - package type: PRE-RELEASE, JSON def.file: $PACKAGE_JSON_DEV"
else
bIsPrerelease=0
package_name_json=$PACKAGE_JSON_REL
echo "Package type: RELEASE, JSON def.files: $PACKAGE_JSON_REL, $PACKAGE_JSON_DEV"
echo " - package type: RELEASE, JSON def.files: $PACKAGE_JSON_REL, $PACKAGE_JSON_DEV"
fi
shopt -u nocasematch
# Generate JSON package definition
echo
echo "----------------------------------------------------------"
echo "Preparing current package definition ($package_name_json)..."
# Cleanup temporary work dir
rm -rf $outdir
# JSON contents
# Get all previously released versions
echo " - fetching previous (pre)release versions from GitHub..."
set +e
releasesJson=$releaseDir/releases.json
curl -sH "Authorization: token $curlAuth" https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases > $releasesJson
prev_release=$(jq -e -r '. | map(select(.draft == false and .prerelease == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' ${releasesJson})
prev_any_release=$(jq -e -r '. | map(select(.draft == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' ${releasesJson})
prev_pre_release=$(jq -e -r '. | map(select(.draft == false and .prerelease == true)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' ${releasesJson})
shopt -s nocasematch
if [ "$prev_any_release" == "$TRAVIS_TAG" ]; then
prev_release=$(jq -e -r '. | map(select(.draft == false and .prerelease == false)) | sort_by(.created_at | - fromdateiso8601) | .[1].tag_name' ${releasesJson})
prev_any_release=$(jq -e -r '. | map(select(.draft == false)) | sort_by(.created_at | - fromdateiso8601) | .[1].tag_name' ${releasesJson})
prev_pre_release=$(jq -e -r '. | map(select(.draft == false and .prerelease == true)) | sort_by(.created_at | - fromdateiso8601) | .[1].tag_name' ${releasesJson})
fi
shopt -u nocasematch
set -e
rm -f "$releasesJson"
echo " previous Release: $prev_release"
echo " previous (?Pre-)release: $prev_any_release"
echo " previous Pre-release: $prev_pre_release"
# add generated items to JSON package-definition contents
jq_arg=".packages[0].platforms[0].version = \"$ver\" | \
.packages[0].platforms[0].url = \"$REMOTE_URL/$package_name_zip\" |\
.packages[0].platforms[0].archiveFileName = \"$package_name_zip\""
@ -283,42 +326,13 @@ jq_arg="$jq_arg |\
.packages[0].platforms[0].size = \"$size\" |\
.packages[0].platforms[0].checksum = \"SHA-256:$sha\""
# Cleanup temporary work dir
rm -rf $outdir
# Get previous release name
echo
echo "----------------------------------------------------------"
echo "Getting previous releases versions..."
releasesJson=$releaseDir/releases.json
curl -sH "Authorization: token $curlAuth" https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases > $releasesJson
# Previous final release (prerelase == false)
prev_release=$(jq -r '. | map(select(.draft == false and .prerelease == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' ${releasesJson})
# Previous release (possibly a pre-release)
prev_any_release=$(jq -r '. | map(select(.draft == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' ${releasesJson})
# Previous pre-release
prev_pre_release=$(jq -r '. | map(select(.draft == false and .prerelease == true)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' ${releasesJson})
rm -f "$releasesJson"
echo "Previous release: $prev_release"
echo "Previous (pre-?)release: $prev_any_release"
echo "Previous pre-release: $prev_pre_release"
# always get DEV version of JSON (included in both RC/REL)
echo
echo "----------------------------------------------------------"
echo "Generating $PACKAGE_JSON_DEV..."
echo
pkgJsonDev=$releaseDir/$PACKAGE_JSON_DEV
echo " - generating/merging _DEV_ JSON file (${pkgJsonDev})..."
cat $srcdir/package/package_esp32_index.template.json | jq "$jq_arg" > $releaseDir/$PACKAGE_JSON_DEV
cat $srcdir/package/package_esp32_index.template.json | jq "$jq_arg" > $pkgJsonDev
if [ ! -z "$prev_any_release" ] && [ "$prev_any_release" != "null" ]; then
downloadAndMergePackageJSON "https://github.com/$TRAVIS_REPO_SLUG/releases/download/${prev_any_release}/${PACKAGE_JSON_DEV}" "$releaseDir/${PACKAGE_JSON_DEV}" "${curlAuth}" "$releaseDir"
downloadAndMergePackageJSON "https://github.com/$TRAVIS_REPO_SLUG/releases/download/${prev_any_release}/${PACKAGE_JSON_DEV}" "${pkgJsonDev}" "${curlAuth}" "$releaseDir"
# Release notes: GIT log comments (prev_any_release, current_release>
git log --oneline $prev_any_release.. > $releaseDir/commits.txt
@ -327,14 +341,12 @@ fi
# for RELEASE run update REL JSON as well
if [ $bIsPrerelease -eq 0 ]; then
echo
echo "----------------------------------------------------------"
echo "Generating $PACKAGE_JSON_REL..."
echo
pkgJsonRel=$releaseDir/$PACKAGE_JSON_REL
echo " - generating/merging _REL_ JSON file (${pkgJsonRel})..."
cat $srcdir/package/package_esp32_index.template.json | jq "$jq_arg" > $releaseDir/$PACKAGE_JSON_REL
cat $srcdir/package/package_esp32_index.template.json | jq "$jq_arg" > $pkgJsonRel
if [ ! -z "$prev_release" ] && [ "$prev_release" != "null" ]; then
downloadAndMergePackageJSON "https://github.com/$TRAVIS_REPO_SLUG/releases/download/${prev_release}/${PACKAGE_JSON_REL}" "$releaseDir/${PACKAGE_JSON_REL}" "${curlAuth}" "$releaseDir"
downloadAndMergePackageJSON "https://github.com/$TRAVIS_REPO_SLUG/releases/download/${prev_release}/${PACKAGE_JSON_REL}" "${pkgJsonRel}" "${curlAuth}" "$releaseDir"
# Release notes: GIT log comments (prev_release, current_release>
git log --oneline $prev_release.. > $releaseDir/commits.txt
@ -342,7 +354,17 @@ if [ $bIsPrerelease -eq 0 ]; then
fi
echo
echo "=============================================================="
echo "Package '$package_name' ready for publishing, script finished."
echo "=============================================================="
echo "JSON definition file(s) creation OK"
echo
echo "==================================================================="
echo "Package preparation done ('$releaseDir' contents):"
fileset=`ls -1 $releaseDir`
echo -e $fileset
echo
echo "==================================================================="
echo "==================================================================="
echo "'$package_name' ready for publishing, processing completed."
echo "==================================================================="
echo

View File

@ -1,12 +1,9 @@
#!/bin/bash
# run cmake tests
tools/check_cmakelists.sh
if [ $? -ne 0 ]; then exit 1; fi
# run sketch tests
tools/build-tests.sh
if [ $? -ne 0 ]; then exit 1; fi
# zip the package if tagged build, otherwise finish here
tools/build-release.sh -a$ESP32_GITHUB_TOKEN
if [ ! -z "$TRAVIS_TAG" ]; then
# zip the package if tagged build
tools/build-release.sh -a$ESP32_GITHUB_TOKEN
else
# run cmake and sketch tests
tools/check_cmakelists.sh && tools/build-tests.sh
fi

View File

@ -46,6 +46,16 @@ while getopts ":t:,:a:,:s:,:p:,:f:,:d:" opt; do
esac
done
# use TravisCI env as default, if available
if [ -z $varTagName ] && [ ! -z $TRAVIS_TAG ]; then
varTagName=$TRAVIS_TAG
fi
if [ -z $varTagName ]; then
echo "No tag name available => aborting"
exit 1
fi
#Check tag name for release/prerelease (prerelease tag contains '_RC' as for release-candidate. case-insensitive)
shopt -s nocasematch
if [ -z $varPrerelease ]; then
@ -108,12 +118,26 @@ fi
releaseNotes=$(perl -pe 's/\r?\n/\\n/' <<< ${releaseNotes})
#JSON parameters to create a new release
curlData="{\"tag_name\": \"$varTagName\",\"target_commitish\": \"master\",\"name\": \"v$varTagName\",\"body\": \"$releaseNotes\",\"draft\": false,\"prerelease\": $varPrerelease}"
# Check possibly existing release for current tag
echo "Checking for possible releases of current tag $varTagName..."
# (eg build invoked by Create New Release GHUI button -> GH default release pack created immediatelly including default assests)
HTTP_RESPONSE=$(curl -L --silent --write-out "HTTPSTATUS:%{http_code}" https://api.github.com/repos/$varRepoSlug/releases/tags/$varTagName?access_token=$varAccessToken)
HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
#Create the release (initial source file assets created by GitHub)
releaseId=$(curl --data "$curlData" https://api.github.com/repos/$varRepoSlug/releases?access_token=$varAccessToken | jq -r '.id')
echo Release ID: $releaseId
echo " HTTP server response code: $HTTP_STATUS"
# if the release exists, append/update recent files to its assets vector
if [ $HTTP_STATUS -eq 200 ]; then
releaseId=$(echo $HTTP_BODY | jq -r '.id')
echo " - $varTagName release found (id $releaseId)"
#... or create a new release record
else
curlData="{\"tag_name\": \"$varTagName\",\"target_commitish\": \"master\",\"name\": \"v$varTagName\",\"body\": \"$releaseNotes\",\"draft\": false,\"prerelease\": $varPrerelease}"
#echo "DEBUG: curl --data \"${curlData}\" https://api.github.com/repos/${varRepoSlug}/releases?access_token=$varAccessToken | jq -r '.id'"
releaseId=$(curl --data "$curlData" https://api.github.com/repos/$varRepoSlug/releases?access_token=$varAccessToken | jq -r '.id')
echo " - new release created for $varTagName (id $releaseId)"
fi
# Assets defined by dir contents
if [ ! -z $varAssetsDir ]; then
@ -133,7 +157,6 @@ if [ ! -z $varAssets ]; then
curlAuth="Authorization: token $varAccessToken"
for filename in $(echo $varAssets | tr ";" "\n")
do
echo
echo
echo Uploading $filename...

Binary file not shown.

View File

@ -190,7 +190,6 @@
#define CONFIG_LOG_BOOTLOADER_LEVEL 0
#define CONFIG_MBEDTLS_TLS_ENABLED 1
#define CONFIG_LWIP_MAX_RAW_PCBS 16
#define CONFIG_SPIRAM_IGNORE_NOTFOUND 1
#define CONFIG_SMP_ENABLE 1
#define CONFIG_SPIRAM_SIZE 4194304
#define CONFIG_MBEDTLS_SSL_SESSION_TICKETS 1
@ -228,6 +227,7 @@
#define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1
#define CONFIG_MONITOR_BAUD 115200
#define CONFIG_ESP32_DEBUG_STUBS_ENABLE 1
#define CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST 1
#define CONFIG_FREERTOS_CORETIMER_0 1
#define CONFIG_PARTITION_TABLE_CUSTOM_FILENAME "partitions.csv"
#define CONFIG_MBEDTLS_HAVE_TIME 1
@ -238,12 +238,10 @@
#define CONFIG_ADC_CAL_EFUSE_VREF_ENABLE 1
#define CONFIG_MBEDTLS_TLS_SERVER 1
#define CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT 1
#define CONFIG_SPIRAM_BOOT_INIT 1
#define CONFIG_FREERTOS_ISR_STACKSIZE 1536
#define CONFIG_CLASSIC_BT_ENABLED 1
#define CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK 1
#define CONFIG_OPENSSL_ASSERT_DO_NOTHING 1
#define CONFIG_SPIRAM_MEMTEST 1
#define CONFIG_WL_SECTOR_SIZE_4096 1
#define CONFIG_OPTIMIZATION_LEVEL_DEBUG 1
#define CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED 1

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -217,17 +217,15 @@ CONFIG_SPIRAM_SUPPORT=y
#
# SPI RAM config
#
CONFIG_SPIRAM_BOOT_INIT=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
CONFIG_SPIRAM_BOOT_INIT=
CONFIG_SPIRAM_USE_MEMMAP=
CONFIG_SPIRAM_USE_CAPS_ALLOC=y
CONFIG_SPIRAM_USE_MALLOC=
CONFIG_SPIRAM_TYPE_ESPPSRAM32=y
CONFIG_SPIRAM_SIZE=4194304
CONFIG_SPIRAM_SPEED_40M=y
CONFIG_SPIRAM_MEMTEST=y
CONFIG_SPIRAM_CACHE_WORKAROUND=y
CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST=
CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST=y
CONFIG_MEMMAP_TRACEMEM=
CONFIG_MEMMAP_TRACEMEM_TWOBANKS=
CONFIG_ESP32_TRAX=

View File

@ -0,0 +1,61 @@
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
#include <stdint.h>
#define EXTERNAL_NUM_INTERRUPTS 16
#define NUM_DIGITAL_PINS 40
#define NUM_ANALOG_INPUTS 18
#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1)
#define digitalPinToInterrupt(p) (((p)<40)?(p):-1)
#define digitalPinHasPWM(p) (p < 34)
static const uint8_t LED_BUILTIN = 0; // ->2812 RGB !!!
#define BUILTIN_LED LED_BUILTIN // backward compatibility
static const uint8_t TX = 1;
static const uint8_t RX = 3;
static const uint8_t SDA = 12;
static const uint8_t SCL = 13;
static const uint8_t SS = 2;
static const uint8_t MOSI = 22;
static const uint8_t MISO = 37;
static const uint8_t SCK = 13;
static const uint8_t A0 = 36;
static const uint8_t A1 = 37;
static const uint8_t A2 = 38;
static const uint8_t A3 = 39;
static const uint8_t A4 = 32;
static const uint8_t A5 = 33;
static const uint8_t A6 = 34;
static const uint8_t A7 = 35;
static const uint8_t A10 = 4;
static const uint8_t A11 = 0;
static const uint8_t A12 = 2;
static const uint8_t A13 = 15;
static const uint8_t A14 = 13;
static const uint8_t A15 = 12;
static const uint8_t A16 = 14;
static const uint8_t A17 = 27;
static const uint8_t A18 = 25;
static const uint8_t A19 = 26;
static const uint8_t T0 = 4;
static const uint8_t T1 = 0;
static const uint8_t T2 = 2;
static const uint8_t T3 = 15;
static const uint8_t T4 = 13;
static const uint8_t T5 = 12;
static const uint8_t T6 = 14;
static const uint8_t T7 = 27;
static const uint8_t T8 = 33;
static const uint8_t T9 = 32;
static const uint8_t DAC1 = 25;
static const uint8_t DAC2 = 26;
#endif /* Pins_Arduino_h */