-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit – firmware that updates itself unconditionally from ou…
…r test server
- Loading branch information
Matěj Sychra
committed
Mar 31, 2017
0 parents
commit b681d1a
Showing
6 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
; PlatformIO Project Configuration File | ||
; | ||
; Build options: build flags, source filter | ||
; Upload options: custom upload port, speed and extra flags | ||
; Library options: dependencies, extra library storages | ||
; Advanced options: extra scripting | ||
; | ||
; Please visit documentation for the other options and examples | ||
; http://docs.platformio.org/page/projectconf.html | ||
|
||
[env:d1_mini] | ||
platform=espressif8266 | ||
board=d1_mini | ||
framework=arduino | ||
|
||
[platformio] | ||
src_dir=thinx-firmware-esp8266 | ||
lib_dir=~/Documents/Arduino/Libraries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/cores/esp8266 | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/variants/d1_mini | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPClient/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266httpUpdate/src | ||
-I/Users/sychram/Documents/Arduino/sketches/sketch_mar26aOTAClient/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ArduinoOTA | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/DNSServer/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/EEPROM | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266AVRISP/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPClient/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPUpdateServer/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266SSDP | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WebServer/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFiMesh/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266httpUpdate/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266mDNS | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/Ethernet/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/GDBStub/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/Hash/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/SD/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/SPI | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/Servo/src | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/SoftwareSerial | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/TFT_Touch_Shield_V2 | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/Ticker | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/Wire | ||
-I/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/esp8266/src | ||
-I/Users/sychram/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include | ||
-I/Users/sychram/.platformio/packages/toolchain-xtensa/lib/gcc/xtensa-lx106-elf/4.8.2/include | ||
-I/Users/sychram/.platformio/packages/toolchain-xtensa/lib/gcc/xtensa-lx106-elf/4.8.2/include-fixed | ||
-DARDUINO=20300 | ||
-DLWIP_OPEN_SRC | ||
-DF_CPU=80000000L | ||
-D__ets__ | ||
-DICACHE_FLASH | ||
-DPLATFORMIO=30201 | ||
-DESP8266 | ||
-DARDUINO_ARCH_ESP8266 | ||
-DESP8266_WEMOS_D1MINI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"execPath": "/Users/sychram/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-g++", | ||
"gccDefaultCFlags": "-fsyntax-only -std=gnu99 -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30201 -DESP8266 -DARDUINO_ARCH_ESP8266 -DESP8266_WEMOS_D1MINI -U__STRICT_ANSI__", | ||
"gccDefaultCppFlags": "-fsyntax-only -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30201 -DESP8266 -DARDUINO_ARCH_ESP8266 -DESP8266_WEMOS_D1MINI -U__STRICT_ANSI__", | ||
"gccErrorLimit": 15, | ||
"gccIncludePaths": "/Users/sychram/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/cores/esp8266,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/variants/d1_mini,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPClient/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266httpUpdate/src,/Users/sychram/Documents/Arduino/sketches/sketch_mar26aOTAClient/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ArduinoOTA,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/DNSServer/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/EEPROM,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266AVRISP/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPClient/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPUpdateServer/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266SSDP,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WebServer/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFiMesh/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266httpUpdate/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266mDNS,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/Ethernet/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/GDBStub/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/Hash/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/SD/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/SPI,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/Servo/src,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/SoftwareSerial,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/TFT_Touch_Shield_V2,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/Ticker,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/Wire,/Users/sychram/.platformio/packages/framework-arduinoespressif8266/libraries/esp8266/src,/Users/sychram/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include,/Users/sychram/.platformio/packages/toolchain-xtensa/lib/gcc/xtensa-lx106-elf/4.8.2/include,/Users/sychram/.platformio/packages/toolchain-xtensa/lib/gcc/xtensa-lx106-elf/4.8.2/include-fixed", | ||
"gccSuppressWarnings": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
[InternetShortcut] | ||
URL=http://docs.platformio.org/page/projectconf.html#envs-dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
d53fc0ba7e2c49849daf2fa19567dd6d5824720b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* OTA enabled firmware for Wemos D1 (ESP 8266, Arduino) */ | ||
|
||
#include <Arduino.h> | ||
#include <ESP8266httpUpdate.h> | ||
|
||
// Requires connectivity, that should be served through WiFiManager | ||
char ssid[] = "<ssid>"; // your network SSID (name) | ||
char pass[] = "<password>"; // your network password | ||
int status = WL_IDLE_STATUS; | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
while (!Serial); | ||
|
||
// check for the presence of the shield: | ||
if (WiFi.status() == WL_NO_SHIELD) { | ||
Serial.println("WiFi shield not present"); | ||
// don't continue: | ||
while(true); | ||
} | ||
|
||
// attempt to connect to Wifi network: | ||
while ( status != WL_CONNECTED) { | ||
Serial.print("Attempting to connect to WPA SSID: "); | ||
Serial.println(ssid); | ||
status = WiFi.begin(ssid, pass); | ||
delay(10000); | ||
} | ||
|
||
delay(500); | ||
|
||
Serial.println("[update] WiFi connected, trying direct update..."); | ||
|
||
t_httpUpdate_return ret = ESPhttpUpdate.update("207.154.200.217", 80, "/bin/5ccf7fee90e0.bin"); | ||
|
||
switch(ret) { | ||
case HTTP_UPDATE_FAILED: | ||
Serial.println("[update] Update failed."); | ||
break; | ||
case HTTP_UPDATE_NO_UPDATES: | ||
Serial.println("[update] Update no Update."); | ||
break; | ||
case HTTP_UPDATE_OK: | ||
Serial.println("[update] Update ok."); // may not called we reboot the ESP | ||
delay(1000); | ||
break; | ||
} | ||
|
||
if (ret != HTTP_UPDATE_OK) { | ||
Serial.println("[update] WiFi connected, trying advanced update..."); | ||
|
||
ret = ESPhttpUpdate.update("207.154.200.217", 80, "ota.php", "5ccf7fee90e0"); | ||
|
||
switch(ret) { | ||
case HTTP_UPDATE_FAILED: | ||
Serial.println("[update] Update failed."); | ||
break; | ||
case HTTP_UPDATE_NO_UPDATES: | ||
Serial.println("[update] Update no Update."); | ||
break; | ||
case HTTP_UPDATE_OK: | ||
Serial.println("[update] Update ok."); // may not called we reboot the ESP | ||
break; | ||
} | ||
} | ||
} | ||
|
||
void loop() { | ||
// | ||
} |