The ArduinoOTAServerBundle provides a HTTP Server to manage OTA for Arduino with ESP8266 wifi chip.
This plugin is developer for Arduino core for ESP8266 WiFi chip. See section https://github.com/esp8266/Arduino/blob/master/doc/ota_updates/readme.md#http-server
Since v.1.2.0 compatible with [Arduino core for ESP32 WiFi chip] (https://github.com/espressif/arduino-esp32).
For documentation, see:
Resources/doc/
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require uegmobile/arduino-ota-server-bundle
This command requires you to have Composer installed globally, as explained
in the installation chapter_ of the Composer documentation.
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php file of your project:
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new UEGMobile\ArduinoOTAServerBundle\UEGMobileArduinoOTAServerBundle(),
);
// ...
}
// ...
}
Import the routing definition in routing.yml:
# app/config/routing.yml
UEGMobileArduinoOTAServerBundle:
resource: "@UEGMobileArduinoOTAServerBundle/Resources/config/routing.yml"
prefix: /aotaserver
Run doctrine commands to update your database model:
$ php app/console doctrine:migrations:diff (Symonfy 2.*)
$ php bin/console doctrine:migrations:diff (Symonfy 3.*)
$ php app/console doctrine:migrations:migrate (Symonfy 2.*)
$ php bin/console doctrine:migrations:migrate (Symonfy 3.*)
NOTE: Upgrades to v1.2.0 from previous versions require run doctrine commands again.
-
Register new binary to be available in OTA server
$ php app/console aotaserver:register:binary
Example:
$ php app/console aotaserver:register:binary arduino.1.2.02.bin 1.2.02 ESP8266-http-Update '1.5.3(aec24ac9)' arduino.1.2.02.bin
Register arduino.1.2.02.bin done!
-
Register/Update a MAC id with a OTA Binary. Chipset with MAC id will receive the last binary file when run ESPhttpUpdate.update method (see 'Configure arduino' section).
$ php app/console aotaserver:register:mac
Example:
$ php app/console app/console aotaserver:register:mac '5C:CF:7F:8C:54:12' 2
Register 5C:CF:7F:8C:54:12 for 2 done!
-
List all binary files availables in OTA server
$ php app/console aotaserver:list
Example:
$ php app/console aotaserver:list
+----+----------------------------+---------------------+-----------------+
| Id | Binary Name | User-Agent | SDK Version |
+----+----------------------------+---------------------+-----------------+
| 2 | arduino.1.2.02.bin | ESP8266-http-Update | 1.5.3(aec24ac9) |
+----+----------------------------+---------------------+-----------------+
TODO: next version
See section https://github.com/esp8266/Arduino/blob/master/doc/ota_updates/readme.md#http-server
void upgrade_firmware(){
Serial.println("upgrade_firmware...");
t_httpUpdate_return ret = ESPhttpUpdate.update(CLOUD_SERVER_IP,
CLOUD_SERVER_PORT,
"/app_dev.php/aotaserver/updateBinary",
FIRMWARE_VERSION);
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;
}
Serial.println("upgrade_firmware...done! ");
}
This bundle is released under the MIT license.