Move defines to hasp_conf.h

This commit is contained in:
fvanroie 2021-04-15 17:15:47 +02:00
parent 9a940b2bcd
commit 04d970f529
4 changed files with 19 additions and 25 deletions

View File

@ -8,6 +8,15 @@
// language specific defines
#include "lang/lang.h"
// TFT defines
#ifndef TFT_BACKLIGHT_ON
#define TFT_BACKLIGHT_ON LOW
#endif
#ifndef TFT_BCKL
#define TFT_BCKL -1
#endif
#define HASP_USE_APP 1
#ifndef HASP_USE_DEBUG
@ -34,6 +43,10 @@
#define HASP_USE_MQTT (HASP_HAS_NETWORK)
#endif
#ifndef MQTT_NODENAME
#define MQTT_NODENAME "plate"
#endif
#ifndef HASP_USE_HTTP
#define HASP_USE_HTTP (HASP_HAS_NETWORK)
#endif

View File

@ -4,22 +4,11 @@
#ifndef HASP_DEVICE_ESP32_H
#define HASP_DEVICE_ESP32_H
#include "hasp_conf.h"
#include "../device.h"
#if defined(ESP32)
#ifndef TFT_BACKLIGHT_ON
#define TFT_BACKLIGHT_ON LOW
#endif
#ifndef MQTT_NODENAME
#define MQTT_NODENAME "plate"
#endif
#ifndef TFT_BCKL
#define TFT_BCKL -1
#endif
namespace dev {
class Esp32Device : public BaseDevice {

View File

@ -16,16 +16,12 @@ class Esp8266Device : public BaseDevice {
public:
Esp8266Device()
{
_hostname = "plate";
_hostname = MQTT_NODENAME;
_backlight_invert = (TFT_BACKLIGHT_ON == LOW);
_backlight_power = 1;
_backlight_invert = 0;
_backlight_level = 100;
_core_version = ESP.getCoreVersion().c_str();
#ifdef TFT_BCKL
_backlight_pin = TFT_BCKL;
#else
_backlight_pin = -1;
#endif
_backlight_pin = TFT_BCKL;
}
void reboot() override;

View File

@ -16,15 +16,11 @@ class Stm32f4Device : public BaseDevice {
public:
Stm32f4Device()
{
_hostname = "plate";
_hostname = MQTT_NODENAME;
_backlight_power = 1;
_backlight_invert = 0;
_backlight_level = 100;
#ifdef TFT_BCKL
_backlight_pin = TFT_BCKL;
#else
_backlight_pin = -1;
#endif
_backlight_pin = TFT_BCKL;
}
void reboot() override;