8 Commits

6 changed files with 59 additions and 14 deletions

6
.gitignore vendored
View File

@ -1 +1,7 @@
/Release/ /Release/
libraries/includes/configuration.cpp
libraries/includes/configuration.h
sketch.esp8266.esp8266.nodemcu.bin
sketch.esp8266.esp8266.nodemcu.elf
sketch/sketch.esp8266.esp8266.nodemcu.bin
sketch/sketch.esp8266.esp8266.nodemcu.elf

View File

@ -4,7 +4,7 @@ stages:
build: build:
stage: build stage: build
image: registry.gitlab.com/wolutator/build-env-arduino:latest image: registry.hottis.de/dockerized/build-env-arduino:latest
tags: tags:
- hottis - hottis
- linux - linux
@ -18,14 +18,12 @@ build:
except: except:
- tags - tags
script: script:
- pushd $CI_PROJECT_DIR/libraries/esp8266boilerplate/ConfigGenerator && ./configGen.sh && popd - ./build.sh build $CI_PROJECT_DIR
- env ARDUINO_SKETCHBOOK_DIR=$CI_PROJECT_DIR arduino-cli compile --fqbn=esp8266:esp8266:nodemcu $CI_PROJECT_DIR/sketch
- cp sketch/sketch.esp8266.esp8266.nodemcu.* .
release: release:
stage: release stage: release
image: registry.gitlab.com/wolutator/base-build-env image: registry.hottis.de/dockerized/base-build-env
tags: tags:
- hottis - hottis
- linux - linux
@ -37,5 +35,5 @@ release:
- release - release
script: script:
- gitlabreleaseuploader.py -p $PRIVATE_TOKEN -i $CI_PROJECT_ID -u $CI_PROJECT_URL - gitlabreleaseuploader.py -p $PRIVATE_TOKEN -i $CI_PROJECT_ID -u $CI_PROJECT_URL
-f sketch.esp8266.esp8266.nodemcu.bin -F releaseInfo.json -T $CI_COMMIT_REF_NAME -f sketch.esp8266.esp8266.nodemcu.bin -F releaseInfo.json -T $CI_COMMIT_REF_NAME -c

36
build.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
if [ "$1" == "" ]; then
echo "Give one of the targets: build, clean, upload"
echo "If you want to use a project directory different"
echo "than the current directory, give it as a second"
echo "argument."
exit 1
fi
if [ "$2" != "" ]; then
PROJECT_DIR=$2
else
PROJECT_DIR=$PWD
fi
if [ "$1" == "build" ]; then
pushd $PROJECT_DIR/libraries/esp8266boilerplate/ConfigGenerator && ./configGen.sh && popd
env ARDUINO_SKETCHBOOK_DIR=$PROJECT_DIR arduino-cli compile --fqbn=esp8266:esp8266:nodemcu $PROJECT_DIR/sketch
cp sketch/sketch.esp8266.esp8266.nodemcu.* .
elif [ "$1" == "clean" ]; then
for D in libraries/includes/configuration.h libraries/includes/configuration.cpp sketch/sketch.esp8266.esp8266.nodemcu.bin sketch/sketch.esp8266.esp8266.nodemcu.elf sketch.esp8266.esp8266.nodemcu.bin sketch.esp8266.esp8266.nodemcu.elf; do
echo -n "About to delete $D ... "
rm $PROJECT_DIR/$D && echo "done"
done
elif [ "$1" == "upload" ]; then
echo "About to upload to device"
esptool.py --port /dev/ttyUSB1 write_flash 0 sketch.esp8266.esp8266.nodemcu.bin
else
echo "Unknown subcommand '$1'"
exit 1
fi

View File

@ -8,7 +8,7 @@
#ifndef DEFINES_H_ #ifndef DEFINES_H_
#define DEFINES_H_ #define DEFINES_H_
//#define DEBUG // #define DEBUG
#define SLEEP #define SLEEP
#define EEPROM_ADDR 0 #define EEPROM_ADDR 0

View File

@ -1,6 +1,7 @@
{ {
"releaseTag": "v0.0.1", "releaseTag": "v0.0.2",
"createReleaseTag": "true", "createReleaseTag": "true",
"createRelease": "true",
"releaseName": "initial", "releaseName": "initial",
"description": "initial automatic build" "description": "initial automatic build"
} }

View File

@ -75,25 +75,29 @@ void read_thermometer() {
} }
void loopApplication() { void loopApplication() {
static uint32_t lastMillis = 0;
mqttLoop(); mqttLoop();
#ifndef SLEEP
static uint32_t lastMillis = 0;
uint32_t currentMillis = millis(); uint32_t currentMillis = millis();
if (currentMillis - lastMillis > 1000) { if (currentMillis - lastMillis > (configBlock.measurePeriod * 1000)) {
lastMillis = currentMillis; lastMillis = currentMillis;
#endif
read_thermometer(); read_thermometer();
#ifndef SLEEP
}
#endif
#ifdef SLEEP #ifdef SLEEP
#ifdef DEBUG #ifdef DEBUG
Serial.println("Sleeping"); Serial.println("Sleeping");
#endif #endif
mqttClient.disconnect(); mqttClient.disconnect();
ESP.deepSleep(configBlock.measurePeriod * 1000000); ESP.deepSleep(configBlock.measurePeriod * 1000000);
#endif #endif
}
} }