Add git tag and version number to an Arduino sketch.

The problem:

Version control and tracking is hard.
For sure in the Arduino IDE, which invites to rapid prototyping and has no built-in version tracking or version control mechanism.

A possible solution:

To make it somewhat more practical and less error prone I made some scripts to assist this process.
It works if you already use or start using git for your version control.

Using these scripts is as easy as adding them to your sketch folder and adding

#include "gitTagVersion.h"
...
Serial.println( sketchVersion );

to your Arduino sketch.
That is all that is needed.

The output in the example above will be something like v1.0.0-3-gab3fb04.
That breaks down to tag v1.0.0, 3 commits since that tag, at commit ab3fb04.

How to install and use?

Continue reading

Debug SNTP on ESP32.

Om debug output van de ESP32 SNTP library in de Arduino IDE weer te geven zijn de volgende stappen nodig:

  1. Installeer ESP-IDF.
  2. Kopieer ~/esp/esp-idf/components/lwip/apps/sntp/sntp.c naar de sketch folder.
  3. Verander in  ~/Arduino/hardware/espressif/esp32/tools/sdk/include/lwip/apps/sntp/sntp_opts.h de optie SNTP_DEBUG van LWIP_DBG_OFF naar LWIP_DBG_ON.
  4. Restart the Arduino IDE and recompile the sketch.

Nu worden de debug messages op de seriële poort weergegeven.

Meer info:

https://github.com/espressif/arduino-esp32/issues/1114

Wacht aantal milliseconden Arduino IDE.

Iets als dit regelt de NTP update in de aquacontrol software:

//    wait a specific interval, accounting for rollover with subtraction!
  
unsigned long timerInterval = 50;  // this is the interval in milliseconds
unsigned long nextTimer = millis() + timerInterval;
  
void loop() {
  lastMillis = millis();
  if ( ( long ) ( millis() - nextTimer ) >= 0 ) {
    Serial.println( "Interval has passed." );    
    nextTimer += timerInterval;
    //do some more stuff...
  }

//rest of the main loop
}

Alles nur geklaut:
http://playground.arduino.cc/Code/TimingRollover

Arduino IDE 1.8.1 setup voor ESP8266

Het probleem

De ‘Get started‘ aanwijzingen voor de WeMos D1 mini op de WeMos site werken niet voor Cellie.
De linker geeft vage foutmeldingen en er komt geen executable tevoorschijn.
Het lijkt dat de aanwijzingen toegespitst zijn op de nieuwe revisie met 16MB flash geheugen.
De linker lijkt te klagen over onvoldoende geheugen blablah…
Anyway,

De oplossing

  1. Installeer de Arduino IDE.
  2. Ga naar File>Preferences en in het veld ‘Additional Boards Manager URLs:‘ voer  de volgende URL in:
    http://arduino.esp8266.com/stable/package_esp8266com_index.json
    en druk op ‘OK‘.
  3. Restart de Arduino IDE.

Should work now.

de links:

https://github.com/esp8266/Arduino#installing-with-boards-manager

ESP8266 – .softAP() en .softAPConfig in Arduino IDE

De config komt na de init. Dus:

WiFi.softAPConfig( myIPAdress, myGateway, mySubnet );
WiFi.softAP( "myAP" );

is fout en

WiFi.softAP( "myAP" );
WiFi.softAPConfig( myIPAdress, myGateway, mySubnet );

is goed.

Same goes for WiFi.config() en WiFi.begin().
Eerst de init dan de config.
https://github.com/esp8266/Arduino/issues/128#issuecomment-96787709