Umstellung auf platformio und drone
continuous-integration/drone/push Build is failing Details

This commit is contained in:
starcalc 2022-06-07 21:10:14 +02:00
parent 0103dbe1e0
commit 8540bf44af
6 changed files with 74 additions and 10 deletions

View File

@ -7,17 +7,22 @@ steps:
image: python:3.10
commands:
- "pip install -U platformio"
#- "cp ampel-firmware/config.public.h ampel-firmware/config.h"
- "platformio run --environment esp8266"
- cp .pio/build/esp8266/firmware.bin esp8266.bin
- "sed -i date/homie/config.json 's/WIFISSID/${iotssid}/'"
- "sed -i date/homie/config.json 's/WIFIPASS/${iotpwd}/'"
- "sed -i date/homie/config.json 's/HOSTNAME/${hostname}/g'"
- "platformio run --target upload --environment d1_mini"
- "platformio run --target uploadfs --environment d1_mini"
- name: release
image: plugins/gitea-release
settings:
base_url: https://gitea.ctdo.de
api_key:
from_secret: gitea_token
files: ./*.bin
upload_port:
from_secret: hostname
iotssid:
from_secret: iotssid
iotpwd:
from_secret: iotpwd
when:
event: tag

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

10
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}

16
data/homie/config.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "HOSTNAME",
"device_id": "HOSTNAME",
"wifi": {
"ssid": "WIFISSID",
"password": "PASSWORD"
},
"mqtt": {
"host": "mqtt.ctdo.de",
"port": 1883,
"auth": false
},
"ota": {
"enabled": true
}
}

30
platformio.ini Normal file
View File

@ -0,0 +1,30 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
;
; If you're recreating this project in PlatformIO, please go to your project folder and execute the following command on your terminal:
; ln -s src/platformio.ini ./platformio.ini
[env:d1_mini]
# platform = espressif8266@^2
platform = espressif8266
board = d1_mini
framework = arduino
upload_speed = 1500000
monitor_speed = 115200
lib_deps =
bblanchon/ArduinoJson
https://github.com/homieiot/homie-esp8266
https://github.com/PaulStoffregen/Encoder.git
https://github.com/adafruit/DHT-sensor-library
https://github.com/adafruit/Adafruit_Sensor
upload_protocol = espota
upload_port = 172.23.23.12 # volumeknob3
upload_flags = --host_port=54321
#upload_port = 10.90.25.206

View File

@ -1,6 +1,3 @@
//curl -X PUT http://192.168.123.1/config --header "Content-Type: application/json" -d '{"name":"volumeknob3", "device_id":"volumeknob3","wifi":{"ssid":"CTDO-IoT","password":"xxx"},"mqtt":{"host":"raum.ctdo.de","port":1883,"ssl":false,"auth":false},"ota":{"enabled":false}}'
#include <Homie.h>
#include <ArduinoOTA.h>
#include <Encoder.h> //Library download: https://github.com/PaulStoffregen/Encoder
@ -30,8 +27,9 @@ long lastPositionCheck=0;
long oldPosition = 0;
HomieNode knobNode("volumeknob", "Volumeknob");
// HomieNode knobNode("volumeknob", "Volumeknob");
HomieNode knobNode("volumeknob", "Volumeknob", "commands");
// HomieNode homieNode("pixel", "pixel", "commands");
void loopHandler() {
@ -44,7 +42,7 @@ void loopHandler() {
long newPosition = myEnc.read()/4;
if (lastPositionCheck+POSITIONUPDATE < millis() && newPosition != oldPosition) {
if ((unsigned long)(lastPositionCheck+POSITIONUPDATE) < millis() && newPosition != oldPosition) {
long positiondiff=newPosition-oldPosition;
oldPosition = newPosition;
Homie.getLogger() << "posdiff= " << positiondiff << endl;