Compare commits
10 Commits
7289d581a8
...
master
Author | SHA1 | Date | |
---|---|---|---|
4a4b8ee788
|
|||
83d6b40b20
|
|||
![]() |
8a0585887c | ||
749b1653a8
|
|||
2441590cb8
|
|||
c9073c1b7d
|
|||
4eb14ef3b5
|
|||
7a6268a074
|
|||
3a8286d445 | |||
063dbcf809
|
@@ -15,3 +15,6 @@ configItems = [
|
|||||||
{"label":"MQTT DebugTopic", "key":"mqttDebugTopic", "type":"C", "length":64, "default":"IoT/RgbLed1/Debug"},
|
{"label":"MQTT DebugTopic", "key":"mqttDebugTopic", "type":"C", "length":64, "default":"IoT/RgbLed1/Debug"},
|
||||||
{"label":"DebugMode", "key":"debugMode", "type":"I", "default":0}
|
{"label":"DebugMode", "key":"debugMode", "type":"I", "default":0}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
magic = 0xC0DE0006
|
||||||
|
appName = "ESP8266 based RgbLedLight"
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
from Cheetah.Template import Template
|
from Cheetah.Template import Template
|
||||||
from ConfigDataStructure import configItems
|
from ConfigDataStructure import configItems, magic, appName
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -23,8 +23,6 @@ from ConfigDataStructure import configItems
|
|||||||
#]
|
#]
|
||||||
|
|
||||||
|
|
||||||
magic = 0xC0DE0005
|
|
||||||
appName = "ESP8266 based TwoLedSignal"
|
|
||||||
confWifiSsid = "espconfig"
|
confWifiSsid = "espconfig"
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
export PROJECTDIR=$PWD/../..
|
export PROJECTDIR=$PWD/../../..
|
||||||
|
|
||||||
export PYTHONPATH=$PYTHONPATH:$PROJECTDIR
|
export PYTHONPATH=$PYTHONPATH:$PROJECTDIR/sketch
|
||||||
|
|
||||||
python -B configGen.py
|
python -B configGen.py
|
||||||
|
|
||||||
mv configuration.cpp configuration.h $PROJECTDIR
|
mv configuration.cpp configuration.h $PROJECTDIR/libraries/includes
|
||||||
|
|
||||||
|
|
||||||
|
12
application.cpp-example
Normal file
12
application.cpp-example
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#include "defines.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
|
|
||||||
|
void setupApplication() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loopApplication() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
12
application.h-example
Normal file
12
application.h-example
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef APPLICATION_H_
|
||||||
|
#define APPLICATION_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void setupApplication();
|
||||||
|
void loopApplication();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* APPLICATION_H_ */
|
@@ -5,7 +5,7 @@
|
|||||||
* Author: wn
|
* Author: wn
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../defines.h"
|
#include <defines.h>
|
||||||
|
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WebServer.h>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "configurationMode.h"
|
#include "configurationMode.h"
|
||||||
#include "../configuration.h"
|
#include <configuration.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -10,7 +10,9 @@
|
|||||||
|
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
|
|
||||||
|
// for Nodemcu use D2
|
||||||
#define CONFIG_SWITCH 0
|
#define CONFIG_SWITCH 0
|
||||||
|
|
||||||
#define EEPROM_ADDR 0
|
#define EEPROM_ADDR 0
|
||||||
|
|
||||||
|
|
||||||
|
4
main.cpp
4
main.cpp
@@ -1,12 +1,12 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "../defines.h"
|
#include <defines.h>
|
||||||
|
|
||||||
// #define ESP8266
|
// #define ESP8266
|
||||||
|
|
||||||
|
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
|
|
||||||
#include "../configuration.h"
|
#include <configuration.h>
|
||||||
#include "productionMode.h"
|
#include "productionMode.h"
|
||||||
#include "configurationMode.h"
|
#include "configurationMode.h"
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "../defines.h"
|
#include <defines.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WebServer.h>
|
||||||
|
|
||||||
#include "../configuration.h"
|
#include <configuration.h>
|
||||||
|
|
||||||
void setup_wifi() {
|
void setup_wifi() {
|
||||||
delay(10);
|
delay(10);
|
||||||
@@ -61,6 +61,9 @@ void setupProduction() {
|
|||||||
|
|
||||||
|
|
||||||
void loopProduction() {
|
void loopProduction() {
|
||||||
|
if (WiFi.status() != WL_CONNECTED) {
|
||||||
|
ESP.reset();
|
||||||
|
}
|
||||||
loopApplication();
|
loopApplication();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
32
readme.md
32
readme.md
@@ -1,28 +1,32 @@
|
|||||||
readme.md
|
# Usage of the esp8266boilerplate project in your own Arduino ESP8266 projects
|
||||||
Created on: Apr 25, 2019
|
|
||||||
Author: Wolfgang Hottgenroth <woho@hottis.de>
|
Wolfgang Hottgenroth <woho@hottis.de>
|
||||||
|
|
||||||
|
|
||||||
* Create an Arduino ESP8266 project in Sloeber
|
* Create an Arduino ESP8266 project in Sloeber
|
||||||
* Add esp8266boilerplate as submodule to your project:
|
* Add esp8266boilerplate as submodule to your project:
|
||||||
|
|
||||||
|
```
|
||||||
git submodule init
|
git submodule init
|
||||||
git submodule add git@gitlab.com:wolutator/esp8266boilerplate.git
|
git submodule add git@gitlab.com:wolutator/esp8266boilerplate.git
|
||||||
* Copy ConfigGenerator/ConfigDataStructure.py-example into your project directory,
|
```
|
||||||
rename it to ConfigDataStructure.py
|
|
||||||
* Edit ConfigDataStructure.py according to your requirements
|
* Copy `ConfigGenerator/ConfigDataStructure.py-example` into your project directory,
|
||||||
* Change into directory ConfigGenerator and run configGen.sh,
|
rename it to `ConfigDataStructure.py`
|
||||||
|
* Edit `ConfigDataStructure.py` according to your requirements
|
||||||
|
* Change into directory ConfigGenerator and run `configGen.sh`,
|
||||||
it generates the configuration code for your projects into your
|
it generates the configuration code for your projects into your
|
||||||
project directory (files configuration.cpp and configuration.h, do not edit
|
project directory (files `configuration.cpp` and `configuration.h`, do not edit
|
||||||
these files)
|
these files)
|
||||||
* Copy defines.h-example into your project directory and edit it
|
* Copy `defines.h-example` into your project directory, rename it to `defines.h` and edit it
|
||||||
according to your requirements
|
according to your requirements
|
||||||
* In to main cpp file of your project you have the functions setup() and loop().
|
* In to main cpp file of your project you have the functions `setup()` and `loop()`.
|
||||||
Edit this file and call mainSetup() from the setup() function and mainLoop() from
|
Edit this file and call `mainSetup()` from the `setup()` function and `mainLoop()` from
|
||||||
the loop() function. Do not change anything else in this file.
|
the `loop()` function. Do not change anything else in this file.
|
||||||
* Add the directory esp8266boilerplate as an include and a source location in the
|
* Add the directory `esp8266boilerplate` as an include and a source location in the
|
||||||
properties of your project.
|
properties of your project.
|
||||||
* Create all the code you need for you application. Call your own main setup function
|
* Create all the code you need for you application. Call your own main setup function
|
||||||
setupApplication() and your own main loop function loopApplication(). These functions
|
`setupApplication()` and your own main loop function `loopApplication()`. These functions
|
||||||
will be called via mainSetup and mainLoop when the system is running in production
|
will be called via mainSetup and mainLoop when the system is running in production
|
||||||
(in contrast to configuration) mode.
|
(in contrast to configuration) mode.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user