diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..080e70d --- /dev/null +++ b/.vscode/extensions.json @@ -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" + ] +} diff --git a/data/homie/config.json b/data/homie/config.json index 770eb3b..7e54ccd 100644 --- a/data/homie/config.json +++ b/data/homie/config.json @@ -3,10 +3,10 @@ "device_id": "ledstoffroehre", "wifi": { "ssid": "CTDO-IoT", -"password": "12345678" +"password": "" }, "mqtt": { -"host": "raum.ctdo.de", +"host": "mqtt.ctdo.de", "port": 1883, "auth": false }, diff --git a/src/main.cpp b/src/main.cpp index 305523c..94595cb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,8 +2,6 @@ #include #include -//curl -X PUT http://homie.config/config -d @config.json --header "Content-Type: application/json" - // homie/ledstoffroehre/lamp/fluorescent0/set #define PIN_LAMP0_EDGE D5 @@ -22,7 +20,7 @@ //int timeout = (1000 - 50); #define FW_NAME "ledstoffroehre" -#define FW_VERSION "1.0.1" +#define FW_VERSION "1.0.2" @@ -58,8 +56,8 @@ int setbrightness0 = 0; int setbrightness1 = 0; bool fluorescent0Active=false; bool fluorescent1Active=false; -int fluorescent0Quality=50; // 0 to 100 -int fluorescent1Quality=50; +int fluorescent0Quality=10; // 0 to 100 +int fluorescent1Quality=10; #define FLUORESCENQUALITYMAX 100 #define FLUORESCENTTEMPMAX 1000 int fluorescent0Temp=0; @@ -80,7 +78,7 @@ int tempincreasemax1=10; //the higher the faster lightup #define FLASHPROBABILITYMIN_MIN 50 #define FLASHPROBABILITYMIN_MAX 100 //should not be more than FLASHPROBABILITY_MIN #define TEMPINCREASEMAX_MIN 1 -#define TEMPINCREASEMAX_MAX FLUORESCENTTEMPMAX/5 +#define TEMPINCREASEMAX_MAX FLUORESCENTTEMPMAX/20 bool lastSensorValue = false; @@ -322,19 +320,13 @@ void loopHandler() bool btn0 = debouncer_btn0.read(); bool btn1 = debouncer_btn1.read(); - if (!btn0){ - if (setbrightness0==0){ - fluorescent0Handler_change("255"); - }else{ - fluorescent0Handler_change("0"); - } + if (!btn0){ //btn0 turns off + fluorescent0Handler_change("0"); + fluorescent1Handler_change("0"); } - if (!btn1){ - if (setbrightness1==0){ - fluorescent1Handler_change("255"); - }else{ - fluorescent1Handler_change("0"); - } + if (!btn1){ //btn1 turns of + fluorescent0Handler_change("255"); + fluorescent1Handler_change("255"); } } @@ -350,9 +342,9 @@ void setup() { debouncer_btn0.attach(PIN_BUTTON0, INPUT_PULLUP); - debouncer_btn0.interval(50); + debouncer_btn0.interval(10); debouncer_btn1.attach(PIN_BUTTON1, INPUT_PULLUP); - debouncer_btn1.interval(50); + debouncer_btn1.interval(10); debouncer.attach(PIN_SENSOR, INPUT); debouncer.interval(50);