mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Add build options
This commit is contained in:
parent
6c3709b4fa
commit
0d5b92b7e5
@ -3,6 +3,10 @@
|
|||||||
|
|
||||||
#define HASP_USE_APP 1
|
#define HASP_USE_APP 1
|
||||||
|
|
||||||
|
#ifndef HASP_USE_DEBUG
|
||||||
|
#define HASP_USE_DEBUG 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Network Services */
|
/* Network Services */
|
||||||
#ifndef HASP_USE_ETHERNET
|
#ifndef HASP_USE_ETHERNET
|
||||||
#define HASP_USE_ETHERNET 0
|
#define HASP_USE_ETHERNET 0
|
||||||
|
@ -4,19 +4,23 @@
|
|||||||
#include "hasp_conf.h"
|
#include "hasp_conf.h"
|
||||||
|
|
||||||
#include "ArduinoJson.h"
|
#include "ArduinoJson.h"
|
||||||
#include "StreamUtils.h" // For EEPromStream
|
#include "ArduinoLog.h"
|
||||||
|
// #include "StreamUtils.h" // For EEPromStream
|
||||||
|
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
#include "hasp_conf.h"
|
#include "hasp_conf.h"
|
||||||
|
|
||||||
|
#if HASP_USE_DEBUG > 0
|
||||||
#include "lv_fs_if.h"
|
#include "lv_fs_if.h"
|
||||||
#include "hasp_debug.h"
|
#include "hasp_debug.h"
|
||||||
#include "hasp_config.h"
|
#include "hasp_config.h"
|
||||||
|
#include "hasp_gui.h"
|
||||||
|
//#include "hasp_filesystem.h" included in hasp_conf.h
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "hasp_object.h"
|
#include "hasp_object.h"
|
||||||
#include "hasp_dispatch.h"
|
#include "hasp_dispatch.h"
|
||||||
//#include "hasp_filesystem.h" included in hasp_conf.h
|
|
||||||
#include "hasp_gui.h"
|
|
||||||
|
|
||||||
#include "hasp_attribute.h"
|
#include "hasp_attribute.h"
|
||||||
#include "hasp.h"
|
#include "hasp.h"
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
#include "hasp_conf.h"
|
#include "hasp_conf.h"
|
||||||
|
|
||||||
|
#if HASP_USE_DEBUG > 0
|
||||||
#include "../hasp_debug.h"
|
#include "../hasp_debug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -59,8 +61,10 @@ void haspGetVersion(char* version,size_t len);
|
|||||||
|
|
||||||
void haspProgressVal(uint8_t val);
|
void haspProgressVal(uint8_t val);
|
||||||
|
|
||||||
|
#if HASP_USE_CONFIG > 0
|
||||||
bool haspGetConfig(const JsonObject & settings);
|
bool haspGetConfig(const JsonObject & settings);
|
||||||
bool haspSetConfig(const JsonObject & settings);
|
bool haspSetConfig(const JsonObject & settings);
|
||||||
|
#endif
|
||||||
|
|
||||||
lv_font_t * hasp_get_font(uint8_t fontid);
|
lv_font_t * hasp_get_font(uint8_t fontid);
|
||||||
|
|
||||||
|
@ -1,24 +1,30 @@
|
|||||||
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
/* MIT License - Copyright (c) 2020 Francis Van Roie
|
||||||
For full license information read the LICENSE file in the project folder */
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
#include "StringStream.h"
|
#include "ArduinoLog.h"
|
||||||
#include "CharStream.h"
|
|
||||||
|
|
||||||
#include "hasp_conf.h"
|
#include "hasp_conf.h"
|
||||||
|
|
||||||
#include "hasp_dispatch.h"
|
#include "hasp_dispatch.h"
|
||||||
#include "hasp_object.h"
|
#include "hasp_object.h"
|
||||||
#include "hasp.h"
|
#include "hasp.h"
|
||||||
|
|
||||||
#include "hasp_debug.h"
|
#if HASP_USE_DEBUG > 0
|
||||||
#include "hasp_gui.h"
|
#include "StringStream.h"
|
||||||
#include "hasp_oobe.h"
|
#include "CharStream.h"
|
||||||
#include "hasp_gpio.h"
|
|
||||||
#include "hasp_hal.h"
|
|
||||||
|
|
||||||
#include "svc/hasp_ota.h"
|
#include "hasp_debug.h"
|
||||||
#include "svc/hasp_mqtt.h"
|
#include "hasp_gui.h"
|
||||||
#include "net/hasp_network.h" // for network_get_status()
|
#include "hasp_oobe.h"
|
||||||
|
#include "hasp_gpio.h"
|
||||||
|
#include "hasp_hal.h"
|
||||||
|
|
||||||
|
#include "svc/hasp_ota.h"
|
||||||
|
#include "svc/hasp_mqtt.h"
|
||||||
|
#include "net/hasp_network.h" // for network_get_status()
|
||||||
|
#else
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_CONFIG > 0
|
#if HASP_USE_CONFIG > 0
|
||||||
#include "hasp_config.h"
|
#include "hasp_config.h"
|
||||||
@ -393,17 +399,22 @@ static void dispatch_get_event_name(uint8_t eventid, char * buffer, size_t size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HASP_USE_GPIO > 0
|
||||||
void dispatch_gpio_event(uint8_t pin, uint8_t group, uint8_t eventid)
|
void dispatch_gpio_event(uint8_t pin, uint8_t group, uint8_t eventid)
|
||||||
{
|
{
|
||||||
char payload[64];
|
char payload[64];
|
||||||
char event[8];
|
char event[8];
|
||||||
dispatch_get_event_name(eventid, event, sizeof(event));
|
dispatch_get_event_name(eventid, event, sizeof(event));
|
||||||
snprintf_P(payload, sizeof(payload), PSTR("{\"pin\":%d,\"group\":%d,\"event\":\"%s\"}"), pin, group, event);
|
snprintf_P(payload, sizeof(payload), PSTR("{\"pin\":%d,\"group\":%d,\"event\":\"%s\"}"), pin, group, event);
|
||||||
|
|
||||||
|
#if HASP_USE_MQTT > 0
|
||||||
mqtt_send_state(F("input"), payload);
|
mqtt_send_state(F("input"), payload);
|
||||||
|
#endif
|
||||||
|
|
||||||
// update outputstates
|
// update outputstates
|
||||||
dispatch_group_state(group, dispatch_get_event_state(eventid), NULL);
|
dispatch_group_state(group, dispatch_get_event_state(eventid), NULL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void dispatch_object_event(lv_obj_t * obj, uint8_t eventid)
|
void dispatch_object_event(lv_obj_t * obj, uint8_t eventid)
|
||||||
{
|
{
|
||||||
@ -498,7 +509,11 @@ void dispatch_parse_json(const char *, const char * payload)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HASP_USE_CONFIG > 0
|
||||||
void dispatch_parse_jsonl(Stream & stream)
|
void dispatch_parse_jsonl(Stream & stream)
|
||||||
|
#else
|
||||||
|
void dispatch_parse_jsonl(std::istringstream & stream)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
uint8_t savedPage = haspGetPage();
|
uint8_t savedPage = haspGetPage();
|
||||||
size_t line = 1;
|
size_t line = 1;
|
||||||
@ -533,8 +548,13 @@ void dispatch_parse_jsonl(Stream & stream)
|
|||||||
|
|
||||||
void dispatch_parse_jsonl(const char *, const char * payload)
|
void dispatch_parse_jsonl(const char *, const char * payload)
|
||||||
{
|
{
|
||||||
|
#if HASP_USE_CONFIG > 0
|
||||||
CharStream stream((char *)payload);
|
CharStream stream((char *)payload);
|
||||||
dispatch_parse_jsonl(stream);
|
dispatch_parse_jsonl(stream);
|
||||||
|
#else
|
||||||
|
std::istringstream stream((char *)payload);
|
||||||
|
dispatch_parse_jsonl(stream);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatch_output_current_page()
|
void dispatch_output_current_page()
|
||||||
@ -627,7 +647,9 @@ void dispatch_reboot(bool saveConfig)
|
|||||||
#if HASP_USE_MQTT > 0
|
#if HASP_USE_MQTT > 0
|
||||||
mqttStop(); // Stop the MQTT Client first
|
mqttStop(); // Stop the MQTT Client first
|
||||||
#endif
|
#endif
|
||||||
|
#if HASP_USE_CONFIG > 0
|
||||||
debugStop();
|
debugStop();
|
||||||
|
#endif
|
||||||
#if HASP_USE_WIFI > 0
|
#if HASP_USE_WIFI > 0
|
||||||
wifiStop();
|
wifiStop();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user