First attempts with Doxygen
This commit is contained in:
3
Makefile
3
Makefile
@ -4,3 +4,6 @@ build:
|
|||||||
otaupload:
|
otaupload:
|
||||||
pip install -r .pio/libdeps/nodemcu/Homie/scripts/ota_updater/requirements.txt
|
pip install -r .pio/libdeps/nodemcu/Homie/scripts/ota_updater/requirements.txt
|
||||||
python .pio/libdeps/nodemcu/Homie/scripts/ota_updater/ota_updater.py -l mqtt.jcktrue.dk -i 18fe34f2f987 .pio/build/nodemcu/firmware.bin
|
python .pio/libdeps/nodemcu/Homie/scripts/ota_updater/ota_updater.py -l mqtt.jcktrue.dk -i 18fe34f2f987 .pio/build/nodemcu/firmware.bin
|
||||||
|
|
||||||
|
docs:
|
||||||
|
doxygen .\.doxygen
|
||||||
|
@ -1,15 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* \file
|
||||||
|
* \class Config
|
||||||
|
*/
|
||||||
#ifndef CONFIG_H
|
#ifndef CONFIG_H
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
#ifndef VERSION
|
#ifndef VERSION
|
||||||
//SEMVER style version
|
//SEMVER style version
|
||||||
|
/**
|
||||||
|
* \brief Version string.
|
||||||
|
* Update as needed. Formatted as SEMVER style string.
|
||||||
|
* See https://semver.org/ for more information.
|
||||||
|
*/
|
||||||
#define VERSION "0.4.5-Dev"
|
#define VERSION "0.4.5-Dev"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the default Serial baudrate in bits/seconds
|
||||||
|
*/
|
||||||
#define CONFIG_SERIAL_BAUDRATE 115200
|
#define CONFIG_SERIAL_BAUDRATE 115200
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pin ID of the output relay
|
||||||
|
*/
|
||||||
#define CONFIG_IO_RELAY D1
|
#define CONFIG_IO_RELAY D1
|
||||||
|
/**
|
||||||
|
* Pin ID of the DHT11 temperature sensor
|
||||||
|
*/
|
||||||
#define CONFIG_IO_DHT11 D2
|
#define CONFIG_IO_DHT11 D2
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interval at which the tempreature is sent in seconds
|
||||||
|
*/
|
||||||
#define CONFIG_TEMPERATURE_SEND_INTERVAL 60
|
#define CONFIG_TEMPERATURE_SEND_INTERVAL 60
|
||||||
#endif
|
#endif
|
25
src/main.cpp
25
src/main.cpp
@ -1,12 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* \brief Entry point
|
||||||
|
*
|
||||||
|
* Deskcontrol is a simple on/off timer switch inteded for use with an ATX PSU.
|
||||||
|
* The theory of operation is turning on and off power by pulling the control line low/high while
|
||||||
|
* running of the 5V standby line.
|
||||||
|
*
|
||||||
|
* Additional features include support for a DHT11 to log the temperature.
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <Homie.h>
|
#include <Homie.h>
|
||||||
|
|
||||||
#include <LoggerNode.h>
|
#include <LoggerNode.h>
|
||||||
LoggerNode LN;
|
LoggerNode LN; ///<Instance of the LoggerNode library
|
||||||
|
|
||||||
#include "DHTesp.h"
|
#include "DHTesp.h"
|
||||||
DHTesp dht;
|
DHTesp dht; ///< DHT instance
|
||||||
|
|
||||||
|
|
||||||
#define OUTPUT_SET(x) digitalWrite(CONFIG_IO_RELAY, x ? LOW : HIGH)
|
#define OUTPUT_SET(x) digitalWrite(CONFIG_IO_RELAY, x ? LOW : HIGH)
|
||||||
@ -15,6 +26,9 @@ unsigned int next_timer_update = 0;
|
|||||||
HomieNode powerNode("power", "Power", "switch");
|
HomieNode powerNode("power", "Power", "switch");
|
||||||
HomieNode temperatureNode("temperature", "Temperature", "temperature");
|
HomieNode temperatureNode("temperature", "Temperature", "temperature");
|
||||||
|
|
||||||
|
/** Power state handler
|
||||||
|
* Handes event on the power state MQTT node
|
||||||
|
*/
|
||||||
bool powerStateHandler(const HomieRange& range, const String& value)
|
bool powerStateHandler(const HomieRange& range, const String& value)
|
||||||
{
|
{
|
||||||
if (value != "on" && value != "off")
|
if (value != "on" && value != "off")
|
||||||
@ -38,6 +52,9 @@ bool powerStateHandler(const HomieRange& range, const String& value)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for events on the powerTimer node
|
||||||
|
*/
|
||||||
bool powerTimerHandler(const HomieRange& range, const String& value)
|
bool powerTimerHandler(const HomieRange& range, const String& value)
|
||||||
{
|
{
|
||||||
int settimer = value.toInt();
|
int settimer = value.toInt();
|
||||||
@ -101,6 +118,10 @@ void loopHandleTemperature()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main event loop
|
||||||
|
* \callgraph
|
||||||
|
*/
|
||||||
void loopHandler()
|
void loopHandler()
|
||||||
{
|
{
|
||||||
loopHandleTimer();
|
loopHandleTimer();
|
||||||
|
Reference in New Issue
Block a user