diff --git a/.travis.yml b/.travis.yml index 924e0c5..3ee8114 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,12 +20,16 @@ matrix: - os: linux env: - MODE=ARDUINO + - BOARD=arduino:samd:arduino_zero_native before_install: - if [ "$MODE" = "LINUX" ]; then eval "${MATRIX_EVAL}"; fi - if [ "$MODE" = "ARDUINO" ]; then source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh); fi - if [ "$MODE" = "ARDUINO" ]; then wget https://github.com/thelsing/FlashStorage/archive/master.zip; fi - - if [ "$MODE" = "ARDUINO" ]; then unzip master.zip -d /home/travis/arduino_ide/libraries; fi + - if [ "$MODE" = "ARDUINO" ]; then unzip master.zip -d $HOME/arduino_ide/libraries; fi + - if [ "$MODE" = "ARDUINO" ]; then wget https://ae-bst.resource.bosch.com/media/_tech/media/bsec/BSEC_1.4.7.3_Generic_Release_20190410.zip; fi + - buildExampleSketch() { arduino --verbose-build --verify --board $BOARD $PWD/examples/$1/$1.ino; } + install: - if [ "$MODE" = "ARDUINO" ]; then arduino --install-library "WiFiManager"; fi script: @@ -34,7 +38,7 @@ script: - if [ "$MODE" = "LINUX" ]; then cd build; fi - if [ "$MODE" = "LINUX" ]; then cmake ..; fi - if [ "$MODE" = "LINUX" ]; then make; fi - - if [ "$MODE" = "ARDUINO" ]; then arduino --verify --board arduino:samd:arduino_zero_native $PWD/examples/knx-demo/knx-demo.ino; fi + - if [ "$MODE" = "ARDUINO" ]; then buildExampleSketch knx-demo; fi notifications: email: diff --git a/examples/knx-vito/basicvito.ino b/examples/knx-vito/basicvito.ino deleted file mode 100644 index 0273996..0000000 --- a/examples/knx-vito/basicvito.ino +++ /dev/null @@ -1,85 +0,0 @@ -/* - -This example defines three datapoints. -The first two are TEMPL type datapoints and have their own callback. -When no specific callback is attached to a datapoint, it uses the global callback. - -Note the difference in return value between the callbacks: -for tempCallback uses value.getFloat() as TEMPL datapoints return a float. -globalCallback uses value.getString(char*,size_t). This method is independent of the returned type. - -*/ -#include -#ifdef ARDUINO_ARCH_ESP8266 -#define SerialDBG Serial1 -#define SerialVito Serial -#endif - - -#ifdef ARDUINO_ARCH_SAMD -#define SerialDBG SerialUSB -#define SerialVito Serial1 -namespace std { - void __throw_bad_alloc() - { - SerialDBG.println("Unable to allocate memory"); - } - - void __throw_length_error(char const*e) - { - SerialDBG.print("Length Error :"); - SerialDBG.println(e); - } -} -#endif - -VitoWiFi_setProtocol(P300); - -DPTemp outsideTemp("outsideTemp", "boiler", 0x5525); -DPTemp boilerTemp("boilertemp", "boiler", 0x0810); -DPStat pumpStat("pump", "heating1", 0x2906); - -void tempCallbackHandler(const IDatapoint& dp, DPValue value) { - SerialDBG.print(dp.getGroup()); - SerialDBG.print(" - "); - SerialDBG.print(dp.getName()); - SerialDBG.print(": "); - SerialDBG.println(value.getFloat()); -} - -void globalCallbackHandler(const IDatapoint& dp, DPValue value) { - SerialDBG.print(dp.getGroup()); - SerialDBG.print(" - "); - SerialDBG.print(dp.getName()); - SerialDBG.print(" is "); - char value_str[15] = { 0 }; - value.getString(value_str, sizeof(value_str)); - SerialDBG.println(value_str); -} - -void setup() { - SerialDBG.begin(115200); - delay(5000); - SerialDBG.println("start"); - - outsideTemp.setCallback(tempCallbackHandler); - boilerTemp.setCallback(tempCallbackHandler); - - // this callback will be used for all DPs without specific callback - // must be set after adding at least 1 datapoint - VitoWiFi.setGlobalCallback(globalCallbackHandler); - - VitoWiFi.setup(&SerialVito); - - SerialDBG.println(F("Setup finished...")); -} - -void loop() { - static unsigned long lastMillis = 0; - if (millis() - lastMillis > 60 * 1000UL) { - // read all values every 60 seconds - lastMillis = millis(); - VitoWiFi.readAll(); - } - VitoWiFi.loop(); -}