2 Commits
Author SHA1 Message Date
Simon Schmidt 1686b9ea2a v1.0.1 ldr corrected 2021-09-06 13:42:55 +02:00
schmidtsi76327 8c45c65d00 templ ini update 2021-09-06 00:46:07 +02:00
4 changed files with 24 additions and 21 deletions
+1 -1
View File
@@ -51,7 +51,7 @@
<div class="param_block">
LDR Schwelle [lx]: <output id="out_ldr_shw" class="val_range">50</output> lx
<div class="slider">
<input type="range" class="regler" id="range_ldr_shw" data-output="out_ldr_shw" min="0" max="100" value="50">
<input type="range" class="regler" id="range_ldr_shw" data-output="out_ldr_shw" min="0" max="1000" value="50">
</div>
</div>
+7 -7
View File
@@ -173,11 +173,15 @@ float Treppe::read_ldr() {
ldr_value = E(LDR)
*/
// float ldr_ohm = 37280.00 / analogRead(A0);
float voltage = analogRead(A0) * 0.0036;
float ldr_ohm = 40.57 * (3.3 - voltage) / voltage;
float vol_adc = analogRead(A0) * 0.0036;
if(vol_adc > 3.29)
vol_adc = 3.29;
float ldr_ohm = 40.67 * (3.3 - vol_adc) / vol_adc;
float ldr_value = 6526.6 / (ldr_ohm * ldr_ohm);
#ifdef LDRDEBUG
Serial.printf("Ohm: %f lux: %f Comp: %d\n", ldr_ohm, ldr_value,
Serial.printf("vol_adc: %f Ohm: %f lux: %f Comp: %d\n", vol_adc, ldr_ohm, ldr_value,
param.ldr_schwelle);
#endif
return ldr_value;
@@ -186,10 +190,6 @@ float Treppe::read_ldr() {
bool Treppe::check_ldr() {
static uint8_t active = 0;
#ifdef LDRDEBUG
// return true;
#endif
// follow up: averaging over many samples?
float ldr = read_ldr();
+2 -2
View File
@@ -5,8 +5,8 @@
#include "PCA9685.h"
#include <EEPROM.h>
//#define LDRDEBUG // comment in to override LDR measurement
#define LDR_HYS 8 // Hysteresis for switching off FSM [lux]
#define LDRDEBUG // comment in to override LDR measurement
#define LDR_HYS 100 // Hysteresis for switching off FSM [lux]
#define SENSOR_OBEN 16
#define SENSOR_UNTEN 12
+14 -11
View File
@@ -19,25 +19,20 @@ platform = espressif8266
; board = nodemcuv2
board = huzzah
framework = arduino
; for pio check
; check_tool = cppcheck
check_tool = clangtidy
check_flags =
; clangtidy: --fix-errors
clangtidy: lib/httpserver/* lib/treppe/* lib/PCA9685-Arduino/*
check_skip_packages = yes
; build_unflags = -Os
; build_flags = -O2
board_build.filesystem = littlefs
board_build.ldscript = eagle.flash.4m1m.ld
extra_scripts = pre:create_gz_files.py
monitor_speed = 76800
[env:serial]
extends = env:hardware
upload_protocol = esptool
upload_speed = 921600
upload_port = COM23
monitor_port = COM23
monitor_speed = 76800
[env:ota]
extends = env:hardware
@@ -45,7 +40,7 @@ extends = env:hardware
upload_protocol = espota
upload_port = <!! IP ADDRESS !!>
upload_flags =
--port=8266
--port=8266
--host_port=<!! PORT !!>
--auth=admin
@@ -56,7 +51,15 @@ extends = env:hardware
build_flags = -DWITH_DEBUGGING_ON -Os -g3 -ggdb3
upload_protocol = esptool
upload_speed = 921600
upload_port = COM23
; for pio check
; check_tool = cppcheck
check_tool = clangtidy
check_flags =
clangtidy: --fix-errors lib/httpserver/*
; clangtidy: lib/httpserver/* lib/treppe/* lib/treppe/FSMTreppe3/* lib/PCA9685-Arduino/*
check_skip_packages = yes
# This file is used compile and run tests located in the `unit` directory.
# For more info, see: