Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7e766f1aae |
52
README.md
52
README.md
@ -1,9 +1,8 @@
|
|||||||
### __How-To use this Project__
|
### Steps to run it
|
||||||
|
|
||||||
1. Download and install [Visual Studio Code](https://code.visualstudio.com/download)
|
https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html
|
||||||
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"
|
##### create "include/wifi_credentials.h"
|
||||||
4. Create [wifi_credentials.h](include/wifi_credentials.h) from [templ_wifi_credentials.h](include/templ_wifi_credentials.h) in include/
|
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#ifndef __WIFI_CREDENTIALS_H
|
#ifndef __WIFI_CREDENTIALS_H
|
||||||
@ -17,31 +16,24 @@
|
|||||||
#endif // __WIFI_CREDENTIALS_H
|
#endif // __WIFI_CREDENTIALS_H
|
||||||
```
|
```
|
||||||
|
|
||||||
5. Create [platformio.ini](platformio.ini) from [templ_platformio_ini](templ_platformio_ini)
|
##### platformio.ini
|
||||||
|
see templ_platformio_ini
|
||||||
|
|
||||||
```sh
|
```ini
|
||||||
$ cp templ_platformio_ini platformio.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
|
||||||
```
|
```
|
||||||
|
|
||||||
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)
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<div class="param_block">
|
<div class="param_block">
|
||||||
<input type="button" class="control" data-action="s_oben" value="sensor_oben">
|
<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="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>
|
||||||
|
|
||||||
<div class="param_block">
|
<div class="param_block">
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
#ifndef __WIFI_CREDENTIALS_H
|
|
||||||
#define __WIFI_CREDENTIALS_H
|
|
||||||
|
|
||||||
#ifndef STASSID
|
|
||||||
#define STASSID "ssid"
|
|
||||||
#define STAPSK "key"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __WIFI_CREDENTIALS_H
|
|
@ -355,16 +355,13 @@ void Treppe::setup() {
|
|||||||
// see also lib/PCA9685-Arduin/PCA9685.h:204
|
// see also lib/PCA9685-Arduin/PCA9685.h:204
|
||||||
pwmController.init(PCA9685_PhaseBalancer_None);
|
pwmController.init(PCA9685_PhaseBalancer_None);
|
||||||
// pwmController.init(PCA9685_PhaseBalancer_Linear);
|
// pwmController.init(PCA9685_PhaseBalancer_Linear);
|
||||||
pwmController.setPWMFrequency(200);
|
pwmController.setPWMFrequency(100);
|
||||||
// pwmController.setAllChannelsPWM(idle_pwm);
|
// pwmController.setAllChannelsPWM(idle_pwm);
|
||||||
|
|
||||||
// WARNING: before getting Parameters of Flash, make sure plausible parameters
|
// WARNING: before getting Parameters of Flash, make sure plausible parameters
|
||||||
// are written in flash!
|
// are written in flash!
|
||||||
EEPROM.get(EEP_START_ADDR, param); // get Parameters of flash
|
EEPROM.get(EEP_START_ADDR, param); // get Parameters of flash
|
||||||
param_pend = param;
|
param_pend = param;
|
||||||
#ifndef LDR_REGELUNG
|
|
||||||
idle_pwm_ist = param.idle_pwm_max;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pinMode(13, OUTPUT);
|
pinMode(13, OUTPUT);
|
||||||
pinMode(0, OUTPUT);
|
pinMode(0, OUTPUT);
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
#include "PCA9685.h"
|
#include "PCA9685.h"
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
|
|
||||||
// #define LDR_REGELUNG // comment in to activate LDR control
|
#define LDR_REGELUNG // comment in to activate LDR control
|
||||||
// #define LDRDEBUG // comment in to show LDR measurement
|
// #define LDRDEBUG // comment in to show LDR measurement
|
||||||
#define LDR_HYS 5 // Hysteresis for switching off FSM [lux]
|
#define LDR_HYS 100 // Hysteresis for switching off FSM [lux]
|
||||||
#define LDR_AVERAGE_SAMPLES 50
|
#define LDR_AVERAGE_SAMPLES 50
|
||||||
|
|
||||||
#define SENSOR_OBEN 16
|
#define SENSOR_OBEN 16
|
||||||
|
@ -9,7 +9,6 @@ extern "C" {
|
|||||||
#include "user_interface.h"
|
#include "user_interface.h"
|
||||||
}
|
}
|
||||||
// OTA & WEB
|
// OTA & WEB
|
||||||
#include <ESP8266mDNS.h>
|
|
||||||
#include "httpserver.h"
|
#include "httpserver.h"
|
||||||
#include "ota.h"
|
#include "ota.h"
|
||||||
#include "wifi_credentials.h"
|
#include "wifi_credentials.h"
|
||||||
@ -23,7 +22,7 @@ extern "C" {
|
|||||||
#include "treppe.h"
|
#include "treppe.h"
|
||||||
os_timer_t timer1;
|
os_timer_t timer1;
|
||||||
uint8_t timer_flag = 0;
|
uint8_t timer_flag = 0;
|
||||||
Treppe stairs(12);
|
Treppe stairs(16);
|
||||||
|
|
||||||
// WIFI
|
// WIFI
|
||||||
const char *ssid = STASSID;
|
const char *ssid = STASSID;
|
||||||
@ -106,10 +105,6 @@ void setup() {
|
|||||||
httpServer.start();
|
httpServer.start();
|
||||||
httpServer.start_apps();
|
httpServer.start_apps();
|
||||||
Serial.println("HTTP server started !");
|
Serial.println("HTTP server started !");
|
||||||
|
|
||||||
if (MDNS.begin("treppenlicht")) {
|
|
||||||
Serial.println("MDNS for treppenlicht started");
|
|
||||||
}
|
|
||||||
|
|
||||||
os_timer_setfn(&timer1, timerCallback, &timer_flag);
|
os_timer_setfn(&timer1, timerCallback, &timer_flag);
|
||||||
os_timer_arm(&timer1, 20, true);
|
os_timer_arm(&timer1, 20, true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user