Compare commits

...

7 Commits

Author SHA1 Message Date
d6f35b82be update readme 2021-09-11 13:19:17 +02:00
3821724a06 update readme 2021-09-11 13:18:33 +02:00
bcad1369af updated readme and added template for wifi creds 2021-09-11 13:17:33 +02:00
Simon Schmidt
e4ad92ca99 hysterese lower 2021-09-07 19:36:05 +02:00
Simon Schmidt
89dcbf27ae mDNS 2021-09-07 10:56:33 +02:00
Simon Schmidt
a0f5ec26d2 hotfix 2021-09-07 10:42:16 +02:00
Simon Schmidt
c95ea1ed22 hotfix 2021-09-07 10:13:24 +02:00
6 changed files with 51 additions and 26 deletions

View File

@ -1,8 +1,9 @@
### Steps to run it
### __How-To use this Project__
https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html
##### create "include/wifi_credentials.h"
1. Download and install [Visual Studio Code](https://code.visualstudio.com/download)
2. Install [PlatformIO IDE extension](https://platformio.org/install/ide?install=vscode) for Visual Studio Code
3. Download sources from master branch, "zip" or "git clone"
4. Create [wifi_credentials.h](include/wifi_credentials.h) from [templ_wifi_credentials.h](include/templ_wifi_credentials.h) in include/
```cpp
#ifndef __WIFI_CREDENTIALS_H
@ -16,24 +17,31 @@ https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html
#endif // __WIFI_CREDENTIALS_H
```
##### platformio.ini
see templ_platformio_ini
5. Create [platformio.ini](platformio.ini) from [templ_platformio_ini](templ_platformio_ini)
```ini
[env:<BOARD>]
platform = espressif8266
board = <BOARD>
framework = arduino
monitor_speed = 115200
extra_scripts = pre:extra_script.py
; stuff for OTA
; https://docs.platformio.org/en/latest/platforms/espressif8266.html#over-the-air-ota-update
upload_protocol = espota
upload_port = <IPADRESS>
upload_flags =
--port=8266
--auth=admin
```sh
$ cp templ_platformio_ini platformio.ini
```
6. __Uploading new firmware__
```sh
# upload program via ota
$ pio run -t upload
# upload file system via ota
$ pio run -t uploadfs
# upload program via Serial Port
# Serial Port needs to be selected in platformio.ini
$ pio run -t upload -e serial
# upload file system via Serial Port
$ pio run -t uploadfs -e serial
```
------
Additional used sources and libraries in this project and [DOKU.md](DOKU.md)
- https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html
- https://github.com/NachtRaveVL/PCA9685-Arduino
- https://arduino-esp8266.readthedocs.io/en/latest/gdb.html
- check different environments inside [platformio.ini](platformio.ini)

View File

@ -14,7 +14,7 @@
<div class="param_block">
<input type="button" class="control" data-action="s_oben" value="sensor_oben">
<input type="button" class="control" data-action="s_unten" value="sensor_unten">
<input type="button" class="control" data-action="on_off" value="on_off">
<!-- <input type="button" class="control" data-action="on_off" value="on_off"> -->
</div>
<div class="param_block">

View File

@ -0,0 +1,9 @@
#ifndef __WIFI_CREDENTIALS_H
#define __WIFI_CREDENTIALS_H
#ifndef STASSID
#define STASSID "ssid"
#define STAPSK "key"
#endif
#endif // __WIFI_CREDENTIALS_H

View File

@ -355,13 +355,16 @@ void Treppe::setup() {
// see also lib/PCA9685-Arduin/PCA9685.h:204
pwmController.init(PCA9685_PhaseBalancer_None);
// pwmController.init(PCA9685_PhaseBalancer_Linear);
pwmController.setPWMFrequency(100);
pwmController.setPWMFrequency(200);
// pwmController.setAllChannelsPWM(idle_pwm);
// WARNING: before getting Parameters of Flash, make sure plausible parameters
// are written in flash!
EEPROM.get(EEP_START_ADDR, param); // get Parameters of flash
param_pend = param;
#ifndef LDR_REGELUNG
idle_pwm_ist = param.idle_pwm_max;
#endif
pinMode(13, OUTPUT);
pinMode(0, OUTPUT);

View File

@ -7,7 +7,7 @@
// #define LDR_REGELUNG // comment in to activate LDR control
// #define LDRDEBUG // comment in to show LDR measurement
#define LDR_HYS 100 // Hysteresis for switching off FSM [lux]
#define LDR_HYS 5 // Hysteresis for switching off FSM [lux]
#define LDR_AVERAGE_SAMPLES 50
#define SENSOR_OBEN 16

View File

@ -9,6 +9,7 @@ extern "C" {
#include "user_interface.h"
}
// OTA & WEB
#include <ESP8266mDNS.h>
#include "httpserver.h"
#include "ota.h"
#include "wifi_credentials.h"
@ -22,7 +23,7 @@ extern "C" {
#include "treppe.h"
os_timer_t timer1;
uint8_t timer_flag = 0;
Treppe stairs(16);
Treppe stairs(12);
// WIFI
const char *ssid = STASSID;
@ -105,6 +106,10 @@ void setup() {
httpServer.start();
httpServer.start_apps();
Serial.println("HTTP server started !");
if (MDNS.begin("treppenlicht")) {
Serial.println("MDNS for treppenlicht started");
}
os_timer_setfn(&timer1, timerCallback, &timer_flag);
os_timer_arm(&timer1, 20, true);