Compare commits

...

11 Commits

10 changed files with 75 additions and 12 deletions

View File

@@ -15,3 +15,6 @@ configItems = [
{"label":"MQTT DebugTopic", "key":"mqttDebugTopic", "type":"C", "length":64, "default":"IoT/RgbLed1/Debug"},
{"label":"DebugMode", "key":"debugMode", "type":"I", "default":0}
]
magic = 0xC0DE0006
appName = "ESP8266 based RgbLedLight"

View File

@@ -1,7 +1,7 @@
#!/usr/bin/python
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"
params = {

View File

@@ -1,12 +1,12 @@
#!/bin/bash
export PROJECTDIR=$PWD/../..
export PROJECTDIR=$PWD/../../..
export PYTHONPATH=$PYTHONPATH:$PROJECTDIR
export PYTHONPATH=$PYTHONPATH:$PROJECTDIR/sketch
python -B configGen.py
mv configuration.cpp configuration.h $PROJECTDIR
mv configuration.cpp configuration.h $PROJECTDIR/libraries/includes

12
application.cpp-example Normal file
View File

@@ -0,0 +1,12 @@
#include "defines.h"
#include "configuration.h"
void setupApplication() {
}
void loopApplication() {
}

12
application.h-example Normal file
View File

@@ -0,0 +1,12 @@
#ifndef APPLICATION_H_
#define APPLICATION_H_
void setupApplication();
void loopApplication();
#endif /* APPLICATION_H_ */

View File

@@ -5,7 +5,7 @@
* Author: wn
*/
#include "../defines.h"
#include <defines.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
@@ -13,7 +13,7 @@
#include "configurationMode.h"
#include "../configuration.h"
#include <configuration.h>

View File

@@ -10,7 +10,9 @@
#define DEBUG
// for Nodemcu use D2
#define CONFIG_SWITCH 0
#define EEPROM_ADDR 0

View File

@@ -1,12 +1,12 @@
#include "main.h"
#include "../defines.h"
#include <defines.h>
// #define ESP8266
#include <EEPROM.h>
#include "../configuration.h"
#include <configuration.h>
#include "productionMode.h"
#include "configurationMode.h"

View File

@@ -7,7 +7,7 @@
#include "../defines.h"
#include <defines.h>
#include <stdio.h>
#include <stdint.h>
@@ -16,7 +16,7 @@
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include "../configuration.h"
#include <configuration.h>
void setup_wifi() {
delay(10);
@@ -61,6 +61,9 @@ void setupProduction() {
void loopProduction() {
if (WiFi.status() != WL_CONNECTED) {
ESP.reset();
}
loopApplication();
}

33
readme.md Normal file
View File

@@ -0,0 +1,33 @@
# Usage of the esp8266boilerplate project in your own Arduino ESP8266 projects
Wolfgang Hottgenroth <woho@hottis.de>
* Create an Arduino ESP8266 project in Sloeber
* Add esp8266boilerplate as submodule to your project:
```
git submodule init
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
* Change into directory ConfigGenerator and run `configGen.sh`,
it generates the configuration code for your projects into your
project directory (files `configuration.cpp` and `configuration.h`, do not edit
these files)
* Copy `defines.h-example` into your project directory, rename it to `defines.h` and edit it
according to your requirements
* 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
the `loop()` function. Do not change anything else in this file.
* Add the directory `esp8266boilerplate` as an include and a source location in the
properties of your project.
* 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
will be called via mainSetup and mainLoop when the system is running in production
(in contrast to configuration) mode.