Skip to content

Conversation

noerw
Copy link
Member

@noerw noerw commented Jul 8, 2022

Bugfixes:

  • Correctly derive WiFi SSID from MAC address when MAC contains 0.
  • Give HTTP clients time to disconnect before rebooting.
  • Fix reconnecting to WiFi access point.
  • Fix occasional freeze during sketch upload.

Improvements:

  • Switch from Arduino IDE to arduino-cli for build script of OTA bootloader. While this introduces yet another tool, builds are less dependent on changes to (badly (un)documented) behavior of the IDE, as arduino-cli is intended to be used in automated contexts. arduino-cli also automates getting the correct libraries, so that should simplify things too.
  • More thorough documentation on the build process.
  • More detailed debug logging when OTA_DEBUG is defined.

Time spent: 4h

@Thiemann96
Copy link
Contributor

Bugfixes seem to work! I have not encountered any errors on Ubuntu or via the senseBox Connect App ! Have not been able to test with a WiFi Bee with a 0 in the MAC address though.

Thanks to the documentation I checked out the build scripts as well! The _ide.sh is having some trouble (error report below), am I missing something here?
But the arduino-cli is running clean, so I was able to test changes to the bootloader. I suppose we're supposed to use the arduino-cli anyways, right?

Thanks for the improvements, bugfixes and documentation :)

./build_ide.sh 
+ set -e
+ ARDUINO=arduino
+ dirname ./build_ide.sh
+ DIR=.
+ SKETCH_NAME=ota_boot.ino
+ SKETCH=./SKETCH_NAME
+ BUILD_PATH=./build
+ OUTPUT_PATH=./../../src/boot
+ [[  == darwin* ]]
./build_ide.sh: 11: [[: not found
+ mkdir -p ./../../src/boot
+ buildSDUBootSketch sensebox:samd:sb:power=off ./../../src/boot/sensebox_mcu.h
+ BOARD=sensebox:samd:sb:power=off
+ DESTINATION=./../../src/boot/sensebox_mcu.h
+ arduino --verify --board sensebox:samd:sb:power=off --preserve-temp-files --pref build.path=./build ./SKETCH_NAME
Picked up JAVA_TOOL_OPTIONS: 
Konfiguration wird geladen...
Pakete werden initialisiert...
Boards werden vorbereitet...
Überprüfungsvorgang...
2022-07-08T13:51:40.236Z INFO c.a.u.n.HttpConnectionManager:148 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Connect to https://builder.arduino.cc/builder/v1/boards/0x04E8/0x6860, method=GET, request id=ADAC6E07177D4CC4
2022-07-08T13:51:40.976Z INFO c.a.u.n.HttpConnectionManager:152 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Request complete URL="https://builder.arduino.cc/builder/v1/boards/0x04E8/0x6860", method=GET, response code=404, request id=ADAC6E07177D4CC4, headers={null=[HTTP/1.1 404 Not Found], Cache-Control=[no-cache, no-store, must-revalidate], Server=[nginx], Connection=[keep-alive], Vary=[Origin], Pragma=[no-cache], Expires=[0], Content-Length=[0], Date=[Fri, 08 Jul 2022 13:51:40 GMT]}
2022-07-08T13:51:40.977Z WARN p.a.h.BoardCloudResolver:64 [cc.arduino.packages.discoverers.serial.SerialDiscovery] Fail to get the Vid Pid information from the builder response code=404
/home/eric/Arduino/libraries/SenseBoxOTA/extra/ota_boot/build/sketch/OTA.cpp.cpp:1:1: error: stray '##' in program
 ##line 5 "/home/eric/Arduino/libraries/SenseBoxOTA/extra/ota_boot/ota_boot.ino"
 ^~
/home/eric/Arduino/libraries/SenseBoxOTA/extra/ota_boot/build/sketch/OTA.cpp.cpp:1:3: error: 'line' does not name a type; did you mean 'int'?
 ##line 5 "/home/eric/Arduino/libraries/SenseBoxOTA/extra/ota_boot/ota_boot.ino"
   ^~~~
   int
ota_boot:0:1: error: 'line' does not name a type; did you mean 'int'?
In file included from /home/eric/.arduino15/packages/arduino/hardware/samd/1.8.11/cores/arduino/api/Interrupts.h:8:0,
                 from /home/eric/.arduino15/packages/arduino/hardware/samd/1.8.11/cores/arduino/api/ArduinoAPI.h:29,
                 from /home/eric/.arduino15/packages/arduino/hardware/samd/1.8.11/cores/arduino/Arduino.h:23,
                 from /home/eric/Arduino/libraries/SenseBoxOTA/extra/ota_boot/build/sketch/OTA.h:5,
                 from /home/eric/Arduino/libraries/SenseBoxOTA/extra/ota_boot/ota_boot.ino:1:
/home/eric/.arduino15/packages/arduino/hardware/samd/1.8.11/cores/arduino/api/Common.h:115:6: error: conflicting declaration of 'void setup()' with 'C' linkage
 void setup(void);
      ^~~~~
/home/eric/Arduino/libraries/SenseBoxOTA/extra/ota_boot/ota_boot.ino:42:6: note: previous declaration with 'C++' linkage
 void setup() {
      ^~~~~
In file included from /home/eric/.arduino15/packages/arduino/hardware/samd/1.8.11/cores/arduino/api/Interrupts.h:8:0,
                 from /home/eric/.arduino15/packages/arduino/hardware/samd/1.8.11/cores/arduino/api/ArduinoAPI.h:29,
                 from /home/eric/.arduino15/packages/arduino/hardware/samd/1.8.11/cores/arduino/Arduino.h:23,
                 from /home/eric/Arduino/libraries/SenseBoxOTA/extra/ota_boot/build/sketch/OTA.h:5,
                 from /home/eric/Arduino/libraries/SenseBoxOTA/extra/ota_boot/ota_boot.ino:1:
/home/eric/.arduino15/packages/arduino/hardware/samd/1.8.11/cores/arduino/api/Common.h:116:6: error: conflicting declaration of 'void loop()' with 'C' linkage
 void loop(void);
      ^~~~
/home/eric/Arduino/libraries/SenseBoxOTA/extra/ota_boot/ota_boot.ino:64:6: note: previous declaration with 'C++' linkage
 void loop() {
      ^~~~

@noerw
Copy link
Member Author

noerw commented Jul 8, 2022

@Thiemann96 nice, glad the arduino-cli workflow works for you.

I moved to arduino-cli, as I encountered the same issues as you with Arduino IDE v1.8.19 and didn't find a simple fix nor the reason for the problem (the IDE inserts junk into the code before compilation, but other sketches worked fine).
The build worked back then with IDE v1.7.xx , so we can either mark this as deprecated / broken with recent IDE versions, or just remove the script for building with Arduino IDE.

just one more improvement to the docs for completeness ;)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants