Revert "Merge master back into gpio-redesign"

This commit is contained in:
fvanroie 2021-04-25 02:10:09 +02:00 committed by GitHub
parent 42feceddc2
commit 268bcb05db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 216 additions and 642 deletions

3
.gitignore vendored
View File

@ -5,13 +5,12 @@
.git
.pio
data/*
src/user_setups/active/*
include/user_config_override.h
src/user_config_override.h
user_config_override.h
platformio_override.ini
user_setups/active/*
src/user_setups/active/*
test/config.yaml
build_output/*
build_output/firmware/*.bin
build_output/firmware/*.exe

View File

@ -1,7 +1,3 @@
#ifdef USE_CONFIG_OVERRIDE
#include "user_config_override.h"
#endif
#include "lv_conf_v7.h"
#define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG

View File

@ -367,19 +367,6 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#endif
#ifndef HASP_FONT_SIZE_1
#define HASP_FONT_SIZE_1 16
#endif
#ifndef HASP_FONT_SIZE_2
#define HASP_FONT_SIZE_2 24
#endif
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 32
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 48
#endif
#else
#ifndef HASP_FONT_1
@ -408,19 +395,6 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#define ROBOTOCONDENSED_REGULAR_32_LATIN1 1
#endif
#ifndef HASP_FONT_SIZE_1
#define HASP_FONT_SIZE_1 12
#endif
#ifndef HASP_FONT_SIZE_2
#define HASP_FONT_SIZE_2 16
#endif
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 24
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 32
#endif
#endif
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.

View File

@ -88,28 +88,9 @@
#define D_HTTP_COLOR_BUTTON_RESET "#d43535" // Restart/Reset/Delete button color - Strong red
*/
/***************************************************
* Font Settings
**************************************************/
// #define HASP_FONT_1 robotocondensed_regular_16_latin1 // Use available fonts from src/fonts directory
// #define HASP_FONT_2 robotocondensed_regular_22_latin1
// #define HASP_FONT_3 robotocondensed_regular_40_latin1
// #define HASP_FONT_4 robotocondensed_regular_48_latin1
// #define ROBOTOCONDENSED_REGULAR_16_LATIN1 1 // Enable the selected fonts
// #define ROBOTOCONDENSED_REGULAR_22_LATIN1 1
// #define ROBOTOCONDENSED_REGULAR_40_LATIN1 1
// #define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
// #define HASP_FONT_SIZE_1 16 // Define used font sizes
// #define HASP_FONT_SIZE_2 22
// #define HASP_FONT_SIZE_3 40
// #define HASP_FONT_SIZE_4 48
/***************************************************
* Other Settings
**************************************************/
//#define HASP_USE_HA // Enable Home Assistant auto-discovery
//#define HASP_GPIO_TEMPLATE "[2360346,2491680,2623009,2097420,2097678,2097947,0,0]" // Lanbon L8-HS: 3 Relays + Moodlight GPIO config
#endif
#endif

View File

@ -49,7 +49,6 @@ build_flags =
-D LV_LVGL_H_INCLUDE_SIMPLE ; for lv_drivers
-D LV_COMP_CONF_INCLUDE_SIMPLE ; for components
-D LV_SYMBOL_DEF_H ; don't load default symbol defines
-D LV_MEM_FULL_DEFRAG_CNT=4 ; stability: run lv_mem_defrag more frequently
; -- ESP build options ------------------------------------
-D SPIFFS_TEMPORAL_FD_CACHE ; speedup opening recent files
; -- ArduinoJson build options ----------------------------
@ -61,8 +60,8 @@ build_flags =
; -- Hasp build options ----------------------------
-D HASP_VER_MAJ=0
-D HASP_VER_MIN=5
-D HASP_VER_REV=1
-D HASP_LOG_LEVEL=LOG_LEVEL_TRACE
-D HASP_VER_REV=0
-D HASP_LOG_LEVEL=LOG_LEVEL_OUTPUT
${override.build_flags}
; -- Shared library dependencies in all environments

View File

@ -1,19 +1,2 @@
/* MIT License - Copyright (c) 2019-2021 Francis Van Roie
For full license information read the LICENSE file in the project folder */
#include "device.h"
#define Q(x) #x
#define QUOTE(x) Q(x)
namespace dev {
const char* BaseDevice::get_model()
{
#ifdef HASP_MODEL
return QUOTE(HASP_MODEL);
#else
return PIOENV;
#endif
}
} // namespace dev

View File

@ -41,7 +41,6 @@ class BaseDevice {
{
return "";
}
const char* get_model();
virtual void init()
{}

View File

@ -37,17 +37,14 @@ const char* Esp32Device::get_hostname()
{
return _hostname.c_str();
}
void Esp32Device::set_hostname(const char* hostname)
{
_hostname = hostname;
}
const char* Esp32Device::get_core_version()
{
return esp_get_idf_version(); // == ESP.getSdkVersion();
}
const char* Esp32Device::get_chip_model()
{
esp_chip_info_t chip_info;

View File

@ -232,7 +232,7 @@ void my_obj_set_value_str_txt(lv_obj_t* obj, uint8_t part, lv_state_t state, con
{
// LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__);
void* value_str_p = (void*)lv_obj_get_style_value_str(obj, part);
const void* value_str_p = lv_obj_get_style_value_str(obj, part);
lv_obj_invalidate(obj);
if(text == NULL || text[0] == 0) {
@ -262,21 +262,36 @@ void my_obj_set_value_str_txt(lv_obj_t* obj, uint8_t part, lv_state_t state, con
return;
}
// lv_obj_set_style_local_value_str(obj, part, state, str_p);
if(value_str_p == text) {
/*If set its own text then reallocate it (maybe its size changed)*/
LOG_DEBUG(TAG_ATTR, "%s %d", __FILE__, __LINE__);
return; // don't touch the data
// value_str_p = lv_mem_realloc(value_str_p, strlen(text) + 1);
// LV_ASSERT_MEM(value_str_p);
// if(value_str_p == NULL) return;
} else {
/*Free the old text*/
if(value_str_p != NULL) {
// LOG_DEBUG(TAG_ATTR, F("%s %d"), __FILE__, __LINE__);
lv_mem_free(value_str_p);
value_str_p = NULL;
// LOG_DEBUG(TAG_ATTR, F("%s %d"), __FILE__, __LINE__);
}
/*Get the size of the text*/
size_t len = strlen(text) + 1;
/*Allocate space for the new text*/
value_str_p = lv_mem_alloc(len);
LV_ASSERT_MEM(value_str_p);
if(value_str_p != NULL) strcpy((char*)value_str_p, text);
lv_obj_set_style_local_value_str(obj, part, state, (char*)value_str_p);
}
/*Get the size of the text*/
size_t len = strlen(text) + 1;
/*Allocate space for the new text*/
value_str_p = lv_mem_realloc(value_str_p, len);
LV_ASSERT_MEM(value_str_p);
if(value_str_p != NULL) strcpy((char*)value_str_p, text);
lv_obj_set_style_local_value_str(obj, part, state, (char*)value_str_p);
// LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__);
}
@ -448,24 +463,24 @@ static lv_font_t* haspPayloadToFont(const char* payload)
#ifndef ARDUINO_ARCH_ESP8266
#ifdef HASP_FONT_1
case HASP_FONT_SIZE_1:
case 12:
return &HASP_FONT_1;
#endif
#ifdef HASP_FONT_2
case HASP_FONT_SIZE_2:
case 16:
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, HASP_FONT_2);
return &HASP_FONT_2;
#endif
#ifdef HASP_FONT_3
case HASP_FONT_SIZE_3:
case 22:
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, HASP_FONT_3);
return &HASP_FONT_3;
#endif
#ifdef HASP_FONT_4
case HASP_FONT_SIZE_4:
case 28:
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, HASP_FONT_4);
return &HASP_FONT_4;
#endif
@ -1777,9 +1792,6 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* p
}
goto attribute_not_found;
case ATTR_COMMENT:
break; // attribute_found
default:
hasp_local_style_attr(obj, attr, attr_hash, payload, update);
}

View File

@ -266,7 +266,6 @@ _HASP_ATTRIBUTE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t)
#define ATTR_BACK 57799
/* Object Attributes */
#define ATTR_COMMENT 62559
#define ATTR_X 120
#define ATTR_Y 121
#define ATTR_W 119

View File

@ -887,18 +887,15 @@ void dispatch_output_statusupdate(const char*, const char*)
{
#if HASP_USE_MQTT > 0
char data[512];
char data[400];
char topic[16];
{
char buffer[128];
haspGetVersion(buffer, sizeof(buffer));
dispatch_get_idle_state(hasp_sleep_state, topic);
snprintf_P(data, sizeof(data),
PSTR("{\"node\":\"%s\",\"manufacturer\":\"" D_MANUFACTURER
"\",\"model\":\"%s\",\"idle\":\"%s\",\"version\":\"%s\",\"uptime\":%lu,"),
haspDevice.get_hostname(), haspDevice.get_model(), topic, buffer,
(unsigned long)(millis() / 1000)); // \"status\":\"available\",
snprintf_P(data, sizeof(data), PSTR("{\"node\":\"%s\",\"idle\":\"%s\",\"version\":\"%s\",\"uptime\":%lu,"),
haspDevice.get_hostname(), topic, buffer, long(millis() / 1000)); // \"status\":\"available\",
#if HASP_USE_WIFI > 0 || HASP_USE_ETHERNET > 0
network_get_statusupdate(buffer, sizeof(buffer));
@ -930,6 +927,13 @@ void dispatch_output_statusupdate(const char*, const char*)
dispatch_state_subtopic(topic, data);
dispatchLastMillis = millis();
/* if(updateEspAvailable) {
mqttStatusPayload += F("\"updateEspAvailable\":true,");
} else {
mqttStatusPayload += F("\"updateEspAvailable\":false,");
}
*/
#endif
}

View File

@ -555,14 +555,3 @@ void cpicker_event_handler(lv_obj_t* obj, lv_event_t event)
// dispatch_normalized_group_value(obj->user_data.groupid, obj, val, min, max);
}
/**
* Called when an object is deleted
* @param obj pointer to a generic object
* @param event type of event that occured
*/
void deleted_event_handler(lv_obj_t* obj, lv_event_t event)
{
uint8_t hasp_event_id;
translate_event(obj, event, hasp_event_id);
}

View File

@ -18,7 +18,6 @@ void slider_event_handler(lv_obj_t* obj, lv_event_t event);
void selector_event_handler(lv_obj_t* obj, lv_event_t event);
void btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event);
void cpicker_event_handler(lv_obj_t* obj, lv_event_t event);
void deleted_event_handler(lv_obj_t* obj, lv_event_t event);
#if HASP_USE_GPIO > 0
void event_gpio_input(uint8_t pin, uint8_t group, uint8_t eventid);

View File

@ -489,20 +489,16 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
case LV_HASP_PAGE:
case HASP_OBJ_PAGE:
obj = lv_page_create(parent_obj, NULL);
if(obj) {
obj->user_data.objid = LV_HASP_PAGE;
lv_obj_set_event_cb(obj, deleted_event_handler); // Needed for memory dealocation
}
if(obj) obj->user_data.objid = LV_HASP_PAGE;
// No event handler for pages
break;
#if LV_USE_WIN && LVGL_VERSION_MAJOR == 7
case LV_HASP_WINDOW:
case HASP_OBJ_WIN:
obj = lv_win_create(parent_obj, NULL);
if(obj) {
obj->user_data.objid = LV_HASP_WINDOW;
lv_obj_set_event_cb(obj, deleted_event_handler); // Needed for memory dealocation
}
if(obj) obj->user_data.objid = LV_HASP_WINDOW;
// No event handler for pages
break;
#endif
@ -554,18 +550,16 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
case LV_HASP_TILEVIEW:
case HASP_OBJ_TILEVIEW:
obj = lv_tileview_create(parent_obj, NULL);
if(obj) {
obj->user_data.objid = LV_HASP_TILEVIEW;
lv_obj_set_event_cb(obj, deleted_event_handler); // Needed for memory dealocation
}
if(obj) obj->user_data.objid = LV_HASP_TILEVIEW;
// No event handler for tileviews
break;
case LV_HASP_TABVIEW:
case HASP_OBJ_TABVIEW:
obj = lv_tabview_create(parent_obj, NULL);
// No event handler for tabs
if(obj) {
lv_obj_set_event_cb(obj, deleted_event_handler); // Needed for memory dealocation
lv_obj_t* tab;
tab = lv_tabview_add_tab(obj, "tab 1");
// lv_obj_set_user_data(tab, id + 1);
@ -593,10 +587,7 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id)
case LV_HASP_SPINNER:
case HASP_OBJ_SPINNER:
obj = lv_spinner_create(parent_obj, NULL);
if(obj) {
obj->user_data.objid = LV_HASP_SPINNER;
lv_obj_set_event_cb(obj, deleted_event_handler); // Needed for memory dealocation
}
if(obj) obj->user_data.objid = LV_HASP_SPINNER;
break;
#endif

View File

@ -152,13 +152,6 @@ void configRead(JsonDocument& settings, bool setupdebug = false)
#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0
LOG_ERROR(TAG_CONF, F(D_FILE_LOAD_FAILED), configFile.c_str());
#ifdef HASP_GPIO_TEMPLATE
char json[100];
snprintf(json, sizeof(json), PSTR("{\"%s\":{\"%s\":%s}}"), (char*)(FPSTR(FP_GPIO)), (char*)(FPSTR(FP_GPIO_CONFIG)), (char*)(FPSTR(HASP_GPIO_TEMPLATE)));
error = deserializeJson(settings, json);
gpioSetConfig(settings[FPSTR(FP_GPIO)]);
#endif
#endif
}
/*

View File

@ -71,10 +71,6 @@ const char FP_HASP[] PROGMEM = "hasp";
const char FP_GUI[] PROGMEM = "gui";
const char FP_DEBUG[] PROGMEM = "debug";
#ifdef HASP_GPIO_TEMPLATE
const char FP_GPIO_TEMPLATE[] PROGMEM = HASP_GPIO_TEMPLATE;
#endif
#endif
#endif // HASP_USE_CONFIG

View File

@ -338,8 +338,6 @@ static void debugPrintLvglMemory(int level, Print* _logOutput)
lv_mem_monitor_t mem_mon;
lv_mem_monitor(&mem_mon);
if(mem_mon.frag_pct > 20) lv_mem_defrag(); // prevents LED shadow crashing
/* Print LVGL Memory Info */
if(debugAnsiCodes) {
if(mem_mon.free_biggest_size > (1024u * 2) && (mem_mon.free_size > 1024u * 2.5) && (mem_mon.frag_pct <= 10))

View File

@ -85,6 +85,46 @@ void debugStopSyslog(void);
std::cout << std::endl; \
fflush(stdout)
/* json keys used in the configfile */
// const char FP_CONFIG_STARTPAGE[] PROGMEM = "startpage";
// const char FP_CONFIG_STARTDIM[] PROGMEM = "startdim";
// const char FP_CONFIG_THEME[] PROGMEM = "theme";
// const char FP_CONFIG_HUE[] PROGMEM = "hue";
// const char FP_CONFIG_ZIFONT[] PROGMEM = "font";
// const char FP_CONFIG_PAGES[] PROGMEM = "pages";
// const char FP_CONFIG_ENABLE[] PROGMEM = "enable";
// const char FP_CONFIG_HOST[] PROGMEM = "host";
// const char FP_CONFIG_PORT[] PROGMEM = "port";
// const char FP_CONFIG_NAME[] PROGMEM = "name";
// const char FP_CONFIG_USER[] PROGMEM = "user";
// const char FP_CONFIG_PASS[] PROGMEM = "pass";
// const char FP_CONFIG_SSID[] PROGMEM = "ssid";
// const char FP_CONFIG_GROUP[] PROGMEM = "group";
// const char FP_CONFIG_BAUD[] PROGMEM = "baud";
// const char FP_CONFIG_LOG[] PROGMEM = "log";
// const char FP_CONFIG_PROTOCOL[] PROGMEM = "proto";
// const char FP_GUI_ROTATION[] PROGMEM = "rotate";
// const char FP_GUI_INVERT[] PROGMEM = "invert";
// const char FP_GUI_TICKPERIOD[] PROGMEM = "tick";
// const char FP_GUI_IDLEPERIOD1[] PROGMEM = "idle1";
// const char FP_GUI_IDLEPERIOD2[] PROGMEM = "idle2";
// const char FP_GUI_CALIBRATION[] PROGMEM = "calibration";
// const char FP_GUI_BACKLIGHTPIN[] PROGMEM = "bckl";
// const char FP_GUI_POINTER[] PROGMEM = "cursor";
// const char FP_DEBUG_TELEPERIOD[] PROGMEM = "tele";
// const char FP_GPIO_CONFIG[] PROGMEM = "config";
// const char FP_HASP_CONFIG_FILE[] PROGMEM = "/config.json";
// const char FP_WIFI[] PROGMEM = "wifi";
// const char FP_MQTT[] PROGMEM = "mqtt";
// const char FP_HTTP[] PROGMEM = "http";
// const char FP_GPIO[] PROGMEM = "gpio";
// const char FP_MDNS[] PROGMEM = "mdns";
// const char FP_HASP[] PROGMEM = "hasp";
// const char FP_GUI[] PROGMEM = "gui";
// const char FP_DEBUG[] PROGMEM = "debug";
#endif
#ifdef __cplusplus

View File

@ -81,16 +81,12 @@ bool mqttHAautodiscover = true;
#define LWT_TOPIC "LWT"
// char mqttServer[16] = MQTT_HOST;
// char mqttUser[23] = MQTT_USER;
// char mqttPassword[32] = MQTT_PASSW;
// char mqttGroupName[16] = MQTT_GROUPNAME;
std::string mqttServer = MQTT_HOST;
std::string mqttUser = MQTT_USER;
std::string mqttPassword = MQTT_PASSW;
std::string mqttGroupName = MQTT_GROUPNAME;
uint16_t mqttPort = MQTT_PORT;
char mqttServer[16] = MQTT_HOST;
char mqttUser[23] = MQTT_USER;
char mqttPassword[32] = MQTT_PASSW;
// char mqttNodeName[16] = MQTT_NODENAME;
char mqttGroupName[16] = MQTT_GROUPNAME;
uint16_t mqttPort = MQTT_PORT;
PubSubClient mqttClient(mqttNetworkClient);
int mqttPublish(const char* topic, const char* payload, size_t len, bool retain)
@ -228,7 +224,7 @@ void mqttStart()
static uint8_t mqttReconnectCount = 0;
// bool mqttFirstConnect = true;
mqttClient.setServer(mqttServer.c_str(), 1883);
mqttClient.setServer(mqttServer, 1883);
// mqttClient.setSocketTimeout(10); //in seconds
/* Construct unique Client ID*/
@ -246,8 +242,7 @@ void mqttStart()
haspProgressMsg(F(D_MQTT_CONNECTING));
haspProgressVal(mqttReconnectCount * 5);
if(!mqttClient.connect(mqttClientId, mqttUser.c_str(), mqttPassword.c_str(), buffer, 0, true, lastWillPayload,
true)) {
if(!mqttClient.connect(mqttClientId, mqttUser, mqttPassword, buffer, 0, true, lastWillPayload, true)) {
// Retry until we give up and restart after connectTimeout seconds
mqttReconnectCount++;
@ -292,16 +287,16 @@ void mqttStart()
return;
}
LOG_INFO(TAG_MQTT, F(D_MQTT_CONNECTED), mqttServer.c_str(), mqttClientId);
LOG_INFO(TAG_MQTT, F(D_MQTT_CONNECTED), mqttServer, mqttClientId);
// Subscribe to our incoming topics
const __FlashStringHelper* F_topic;
F_topic = F("%scommand/#");
mqttSubscribeTo(F_topic, mqttGroupTopic);
mqttSubscribeTo(F_topic, mqttNodeTopic);
F_topic = F("%sconfig/#");
mqttSubscribeTo(F_topic, mqttGroupTopic);
mqttSubscribeTo(F_topic, mqttNodeTopic);
// F_topic = F("%sconfig/#");
// mqttSubscribeTo(F_topic, mqttGroupTopic);
// mqttSubscribeTo(F_topic, mqttNodeTopic);
// mqttSubscribeTo(F("%slight/#"), mqttNodeTopic);
// mqttSubscribeTo(F("%sbrightness/#"), mqttNodeTopic);
// mqttSubscribeTo(F("%s"LWT_TOPIC), mqttNodeTopic);
@ -328,9 +323,9 @@ void mqttStart()
void mqttSetup()
{
mqttEnabled = mqttServer.length() > 0 && mqttPort > 0;
mqttEnabled = strlen(mqttServer) > 0 && mqttPort > 0;
if(mqttEnabled) {
mqttClient.setServer(mqttServer.c_str(), mqttPort);
mqttClient.setServer(mqttServer, mqttPort);
mqttClient.setCallback(mqtt_message_cb);
// if(!mqttClient.setBufferSize(1024)) {
// LOG_ERROR(TAG_MQTT, F("Buffer allocation failed"));
@ -378,19 +373,19 @@ bool mqttGetConfig(const JsonObject& settings)
if(strcmp(haspDevice.get_hostname(), settings[FPSTR(FP_CONFIG_NAME)].as<String>().c_str()) != 0) changed = true;
settings[FPSTR(FP_CONFIG_NAME)] = haspDevice.get_hostname();
if(mqttGroupName != settings[FPSTR(FP_CONFIG_GROUP)].as<std::string>()) changed = true;
if(strcmp(mqttGroupName, settings[FPSTR(FP_CONFIG_GROUP)].as<String>().c_str()) != 0) changed = true;
settings[FPSTR(FP_CONFIG_GROUP)] = mqttGroupName;
if(mqttServer != settings[FPSTR(FP_CONFIG_HOST)].as<std::string>()) changed = true;
if(strcmp(mqttServer, settings[FPSTR(FP_CONFIG_HOST)].as<String>().c_str()) != 0) changed = true;
settings[FPSTR(FP_CONFIG_HOST)] = mqttServer;
if(mqttPort != settings[FPSTR(FP_CONFIG_PORT)].as<uint16_t>()) changed = true;
settings[FPSTR(FP_CONFIG_PORT)] = mqttPort;
if(mqttUser != settings[FPSTR(FP_CONFIG_USER)].as<String>().c_str()) changed = true;
if(strcmp(mqttUser, settings[FPSTR(FP_CONFIG_USER)].as<String>().c_str()) != 0) changed = true;
settings[FPSTR(FP_CONFIG_USER)] = mqttUser;
if(mqttPassword != settings[FPSTR(FP_CONFIG_PASS)].as<String>().c_str()) changed = true;
if(strcmp(mqttPassword, settings[FPSTR(FP_CONFIG_PASS)].as<String>().c_str()) != 0) changed = true;
settings[FPSTR(FP_CONFIG_PASS)] = mqttPassword;
if(changed) configOutput(settings, TAG_MQTT);
@ -428,33 +423,33 @@ bool mqttSetConfig(const JsonObject& settings)
}
if(!settings[FPSTR(FP_CONFIG_GROUP)].isNull()) {
changed |= mqttGroupName != settings[FPSTR(FP_CONFIG_GROUP)].as<std::string>();
mqttGroupName = settings[FPSTR(FP_CONFIG_GROUP)].as<std::string>();
changed |= strcmp(mqttGroupName, settings[FPSTR(FP_CONFIG_GROUP)]) != 0;
strncpy(mqttGroupName, settings[FPSTR(FP_CONFIG_GROUP)], sizeof(mqttGroupName));
}
if(mqttGroupName.length() == 0) {
mqttGroupName = String(F("plates")).c_str();
changed = true;
if(strlen(mqttGroupName) == 0) {
strcpy_P(mqttGroupName, PSTR("plates"));
changed = true;
}
if(!settings[FPSTR(FP_CONFIG_HOST)].isNull()) {
changed |= mqttServer != settings[FPSTR(FP_CONFIG_HOST)].as<std::string>();
mqttServer = settings[FPSTR(FP_CONFIG_HOST)].as<std::string>();
changed |= strcmp(mqttServer, settings[FPSTR(FP_CONFIG_HOST)]) != 0;
strncpy(mqttServer, settings[FPSTR(FP_CONFIG_HOST)], sizeof(mqttServer));
}
if(!settings[FPSTR(FP_CONFIG_USER)].isNull()) {
changed |= mqttUser != settings[FPSTR(FP_CONFIG_USER)].as<std::string>();
mqttUser = settings[FPSTR(FP_CONFIG_USER)].as<std::string>();
changed |= strcmp(mqttUser, settings[FPSTR(FP_CONFIG_USER)]) != 0;
strncpy(mqttUser, settings[FPSTR(FP_CONFIG_USER)], sizeof(mqttUser));
}
if(!settings[FPSTR(FP_CONFIG_PASS)].isNull() &&
settings[FPSTR(FP_CONFIG_PASS)].as<String>() != String(FPSTR(D_PASSWORD_MASK))) {
changed |= mqttPassword != settings[FPSTR(FP_CONFIG_PASS)].as<std::string>();
mqttPassword = settings[FPSTR(FP_CONFIG_PASS)].as<std::string>();
changed |= strcmp(mqttPassword, settings[FPSTR(FP_CONFIG_PASS)]) != 0;
strncpy(mqttPassword, settings[FPSTR(FP_CONFIG_PASS)], sizeof(mqttPassword));
}
snprintf_P(mqttNodeTopic, sizeof(mqttNodeTopic), PSTR(MQTT_PREFIX "/%s/"), haspDevice.get_hostname());
snprintf_P(mqttGroupTopic, sizeof(mqttGroupTopic), PSTR(MQTT_PREFIX "/%s/"), mqttGroupName.c_str());
snprintf_P(mqttGroupTopic, sizeof(mqttGroupTopic), PSTR(MQTT_PREFIX "/%s/"), mqttGroupName);
return changed;
}

View File

@ -138,7 +138,7 @@ const char HTTP_SCRIPT[] PROGMEM = "<script>function "
const char HTTP_HEADER_END[] PROGMEM =
"</head><body><div style='text-align:left;display:inline-block;color:" D_HTTP_COLOR_TEXT ";min-width:260px;'>";
const char HTTP_END[] PROGMEM = "<div style='text-align:right;font-size:11px;'><hr/><a href='/about' "
"style='color:" D_HTTP_COLOR_TEXT ";'>" D_MANUFACTURER " ";
"style='color:" D_HTTP_COLOR_TEXT ";'>HASP ";
const char HTTP_FOOTER[] PROGMEM = " by Francis Van Roie</div></body></html>";
////////////////////////////////////////////////////////////////////////////////////////////////////
@ -528,11 +528,8 @@ void webHandleInfo()
httpMessage += haspDevice.get_hostname();
httpMessage += F("</h1><hr>");
httpMessage += F("<b>Model: </b>");
httpMessage += haspDevice.get_model();
/* HASP Stats */
httpMessage += F("<br/><b>Version: </b>");
httpMessage += F("<b>HASP Version: </b>");
{
char version[32];
haspGetVersion(version, sizeof(version));

View File

@ -1,11 +1,11 @@
# Copy and rename this file to config.yaml
# config.yaml
---
name: Common test information
description: Connection information for MQTT Client
variables:
host: homeassistant.local
username: <mqtt_username>
password: <mqtt_password>
username: hasp
password: hasp
port: 1883
plate: <platename>
plate: plate35

View File

@ -1,35 +1,6 @@
# test_value_str.tavern.yaml
---
test_name: Colors setup
includes:
- !include config.yaml
paho-mqtt:
client:
transport: tcp
client_id: tavern-tester
connect:
host: "{host}"
port: !int "{port:d}"
timeout: 3
auth:
username: "{username}"
password: "{password}"
stages:
- name: Page 1
mqtt_publish:
topic: hasp/{plate}/command
payload: "page 1"
mqtt_response:
topic: hasp/{plate}/state/page
payload: "1"
timeout: 1
delay_after: 0
---
test_name: Colors loop
test_name: Obj Standard Properties
includes:
- !include config.yaml
@ -106,10 +77,27 @@ marks:
- btn
stages:
- name: Page 1
mqtt_publish:
topic: hasp/{plate}/command
payload: "page 1"
mqtt_response:
topic: hasp/{plate}/state/page
payload: "1"
timeout: 1
delay_after: 0
- name: Set bg_color
mqtt_publish:
topic: hasp/{plate}/command/json
payload: '["p1b0.bg_color={color}","clearpage"]'
topic: hasp/{plate}/command
payload: "p[1].b[0].bg_color={color}"
delay_after: 0.02
- name: Clear page
mqtt_publish:
topic: hasp/{plate}/command/clearpage
payload: ""
delay_after: 0.02
- name: Create object
mqtt_publish:
@ -121,16 +109,18 @@ stages:
r: !int "{r:d}"
g: !int "{g:d}"
b: !int "{b:d}"
delay_after: 0.02
- name: Set bg_color
mqtt_publish:
topic: hasp/{plate}/command
payload: "p[1].b[0].bg_color={rgb565}"
delay_after: 0.02
- name: Test named COLOR
mqtt_publish:
topic: hasp/{plate}/command/json
payload: '["p1b1.text_color={color}","p1b1.text_color"]'
payload: '["p[1].b[1].text_color={color}","p[1].b[1].text_color"]'
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:
@ -143,12 +133,13 @@ stages:
- name: Reset
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.text_color=123"
payload: "p[1].b[1].text_color=123"
delay_after: 0.02
- name: Test hex COLOR
mqtt_publish:
topic: hasp/{plate}/command/json
payload: '["p1b1.text_color={hex}","p1b1.text_color"]'
payload: '["p[1].b[1].text_color={hex}","p[1].b[1].text_color"]'
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:
@ -161,12 +152,13 @@ stages:
- name: Reset
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.text_color=529"
payload: "p[1].b[1].text_color=529"
delay_after: 0.02
- name: Test rgb565 COLOR
mqtt_publish:
topic: hasp/{plate}/command/json
payload: '["p1b1.text_color={rgb565}","p1b1.text_color"]'
payload: '["p[1].b[1].text_color={rgb565}","p[1].b[1].text_color"]'
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:

View File

@ -1,227 +0,0 @@
# test_page.tavern.yaml
---
test_name: Cpicker setup
includes:
- !include config.yaml
paho-mqtt:
client:
transport: tcp
client_id: tavern-tester
connect:
host: "{host}"
port: !int "{port:d}"
timeout: 3
auth:
username: "{username}"
password: "{password}"
stages:
- name: Page 1
mqtt_publish:
topic: hasp/{plate}/command
payload: "page 1"
mqtt_response:
topic: hasp/{plate}/state/page
payload: "1"
timeout: 1
- name: Clear page
mqtt_publish:
topic: hasp/{plate}/command/clearpage
payload: ""
---
test_name: Cpicker loop
includes:
- !include config.yaml
paho-mqtt:
client:
transport: tcp
client_id: tavern-tester
connect:
host: "{host}"
port: !int "{port:d}"
timeout: 3
auth:
username: "{username}"
password: "{password}"
marks:
- parametrize:
key:
- color
- hex
- r
- g
- b
- rgb565
vals:
- ["red", "#ff0000", 255, 0, 0, 63488]
- ["tan", "#d2b48c", 213, 182, 139, 54705]
- ["aqua", "#00ffff", 0, 255, 255, 2047]
- ["blue", "#0000ff", 0, 0, 255, 31]
- ["cyan", "#00ffff", 0, 255, 255, 2047]
- ["gold", "#ffd600", 255, 214, 0, 65184]
- ["gray", "#838183", 131, 129, 131, 33808]
- ["grey", "#838183", 131, 129, 131, 33808]
- ["lime", "#00ff00", 0, 255, 0, 2016]
- ["navy", "#000083", 0, 0, 131, 16]
- ["peru", "#cd8139", 205, 129, 57, 52263]
- ["pink", "#ffc2cd", 255, 194, 205, 65049]
- ["plum", "#dea1de", 222, 161, 222, 56603]
- ["snow", "#fffaff", 255, 250, 255, 65503]
- ["teal", "#008183", 0, 129, 131, 1040]
- ["azure", "#f6ffff", 246, 255, 255, 63487]
- ["beige", "#f6f6de", 246, 246, 222, 63419]
- ["black", "#000000", 0, 0, 0, 0]
- ["blush", "#b50000", 181, 0, 0, 45056]
- ["brown", "#a42829", 164, 40, 41, 41285]
- ["coral", "#ff7d52", 255, 125, 82, 64490]
- ["green", "#008100", 0, 129, 0, 1024]
- ["ivory", "#fffff6", 255, 255, 246, 65534]
- ["khaki", "#f6e28b", 246, 226, 139, 63281]
- ["linen", "#fff2ee", 255, 242, 238, 65436]
- ["olive", "#837d00", 131, 125, 0, 33792]
- ["wheat", "#f6dab5", 246, 218, 181, 63222]
- ["white", "#ffffff", 255, 255, 255, 65535]
- ["bisque", "#ffe6c5", 255, 230, 197, 65336]
- ["indigo", "#4a0083", 74, 0, 131, 18448]
- ["maroon", "#830000", 131, 0, 0, 32768]
- ["orange", "#ffa500", 255, 165, 0, 64800]
- ["orchid", "#de71d5", 222, 113, 213, 56218]
- ["purple", "#7b0083", 123, 0, 131, 32784]
- ["salmon", "#ff8173", 255, 129, 115, 64526]
- ["sienna", "#a44c29", 164, 76, 41, 41605]
- ["tomato", "#ff6141", 255, 97, 65, 64264]
- ["violet", "#ee81ee", 230, 129, 238, 60445]
- ["yellow", "#ffff00", 255, 255, 0, 65504]
- ["fuchsia", "#f600ff", 246, 0, 255, 63519]
- ["magenta", "#f600ff", 246, 0, 255, 63519]
- ["silver", "#c5c2c5", 197, 194, 197, 50712]
stages:
- name: Set bg_color
mqtt_publish:
topic: hasp/{plate}/command
payload: "p[1].b[0].bg_color={color}"
- name: Create cpicker
mqtt_publish:
topic: hasp/{plate}/command/jsonl
json:
obj: "cpicker"
id: 1
color: "{color}"
- name: Test named COLOR
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.color"
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:
color: "{hex}"
r: !int "{r:d}"
g: !int "{g:d}"
b: !int "{b:d}"
timeout: 1
- name: Test hex COLOR
mqtt_publish:
topic: hasp/{plate}/command/json
payload: '["p1b1.color={hex}","p1b1.color"]'
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:
color: "{hex}"
r: !int "{r:d}"
g: !int "{g:d}"
b: !int "{b:d}"
timeout: 1
- name: Reset
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.color=529"
- name: Test rgb565 COLOR
mqtt_publish:
topic: hasp/{plate}/command/json
payload: '["p1b1.color={rgb565}","p1b1.color"]'
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:
color: "{hex}"
r: !int "{r:d}"
g: !int "{g:d}"
b: !int "{b:d}"
timeout: 1
---
test_name: Value String Loop
includes:
- !include config.yaml
paho-mqtt:
client:
transport: tcp
client_id: tavern-tester
connect:
host: "{host}"
port: !int "{port:d}"
timeout: 3
auth:
username: "{username}"
password: "{password}"
marks:
- parametrize:
key: str1
vals:
- "Test 123456 longer strings work too"
- "The cat stretched."
- "Jacob stood on his tiptoes."
- "The car turned the corner."
- "Kelly twirled in circles."
- "She opened the door."
- "Aaron made a picture."
- "I'm sorry."
- huey
- dewey
- ""
- parametrize:
key: str2
vals:
- louie
- " I danced."
- " Oak is strong and also gives shade."
- " Cats and dogs each hate the other."
- " The pipe began to rust while new."
- " Open the crate but don't break the glass."
- " Add the sum to the product of these three."
- " Thieves who rob friends deserve jail."
- " The ripe taste of cheese improves with age."
- " Act on these orders with great speed."
- " The hog crawled under the high fence."
- " Move the vat over the hot fire."
- ""
stages:
- name: Set value_str
mqtt_publish:
topic: "hasp/{plate}/command/p1b1.value_str"
payload: "{str1}{str2}"
- name: Get value_str
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.value_str"
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:
value_str: "{str1}{str2}"
timeout: 1

View File

@ -26,11 +26,13 @@ stages:
topic: hasp/{plate}/state/page
payload: "1"
timeout: 1
delay_after: 0.02
- name: Clear page
mqtt_publish:
topic: hasp/{plate}/command/clearpage
payload: ""
delay_after: 0.02
- name: Create object
mqtt_publish:
@ -38,12 +40,13 @@ stages:
json:
objid: 12
id: 1
delay_after: 0.02
- name: Set x
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.x=50"
delay_after: 0.02
- name: Get x
mqtt_publish:
topic: hasp/{plate}/command
@ -71,7 +74,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.y=50"
delay_after: 0.02
- name: Get y
mqtt_publish:
topic: hasp/{plate}/command
@ -85,7 +88,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.y=25"
delay_after: 0.02
- name: Get y
mqtt_publish:
topic: hasp/{plate}/command
@ -100,7 +103,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.w=50"
delay_after: 0.02
- name: Get w
mqtt_publish:
topic: hasp/{plate}/command
@ -128,7 +131,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.h=50"
delay_after: 0.02
- name: Get h
mqtt_publish:
topic: hasp/{plate}/command
@ -142,7 +145,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.h=25"
delay_after: 0.02
- name: Get h
mqtt_publish:
topic: hasp/{plate}/command
@ -157,7 +160,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.mode=crop"
delay_after: 0.02
- name: Get mode
mqtt_publish:
topic: hasp/{plate}/command
@ -167,7 +170,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.w=50"
delay_after: 0.02
- name: Get w
mqtt_publish:
topic: hasp/{plate}/command
@ -195,7 +198,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.h=50"
delay_after: 0.02
- name: Get h
mqtt_publish:
topic: hasp/{plate}/command
@ -209,7 +212,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.h=45"
delay_after: 0.02
- name: Get h
mqtt_publish:
topic: hasp/{plate}/command
@ -224,7 +227,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.enabled=0"
delay_after: 0.02
- name: Get enabled
mqtt_publish:
topic: hasp/{plate}/command
@ -238,7 +241,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.enabled=1"
delay_after: 0.02
- name: Get enabled
mqtt_publish:
topic: hasp/{plate}/command
@ -253,7 +256,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.hidden=1"
delay_after: 0.02
- name: Get hidden
mqtt_publish:
topic: hasp/{plate}/command
@ -277,7 +280,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.hidden=0"
delay_after: 0.02
- name: Get hidden
mqtt_publish:
topic: hasp/{plate}/command
@ -301,7 +304,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.vis=0"
delay_after: 0.02
- name: Get hidden
mqtt_publish:
topic: hasp/{plate}/command
@ -325,7 +328,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.vis=1"
delay_after: 0.02
- name: Get hidden
mqtt_publish:
topic: hasp/{plate}/command
@ -344,69 +347,3 @@ stages:
json:
vis: 1
timeout: 1
---
test_name: Value String Loop
includes:
- !include config.yaml
paho-mqtt:
client:
transport: tcp
client_id: tavern-tester
connect:
host: "{host}"
port: !int "{port:d}"
timeout: 3
auth:
username: "{username}"
password: "{password}"
marks:
- parametrize:
key: str1
vals:
- "Test 123456 longer strings work too"
- "The cat stretched."
- "Jacob stood on his tiptoes."
- "The car turned the corner."
- "Kelly twirled in circles."
- "She opened the door."
- "Aaron made a picture."
- "I'm sorry."
- huey
- dewey
- ""
- parametrize:
key: str2
vals:
- louie
- " I danced."
- " Oak is strong and also gives shade."
- " Cats and dogs each hate the other."
- " The pipe began to rust while new."
- " Open the crate but don't break the glass."
- " Add the sum to the product of these three."
- " Thieves who rob friends deserve jail."
- " The ripe taste of cheese improves with age."
- " Act on these orders with great speed."
- " The hog crawled under the high fence."
- " Move the vat over the hot fire."
- ""
stages:
- name: Set value_str
mqtt_publish:
topic: "hasp/{plate}/command/p1b1.value_str"
payload: "{str1}{str2}"
- name: Get value_str
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.value_str"
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:
value_str: "{str1}{str2}"
timeout: 1

View File

@ -26,7 +26,7 @@ stages:
topic: hasp/{plate}/state/page
payload: "1"
timeout: 1
delay_after: 0
- name: step 2 - Page test
mqtt_publish:
topic: hasp/{plate}/command
@ -35,7 +35,7 @@ stages:
topic: hasp/{plate}/state/page
payload: "2"
timeout: 1
delay_after: 0
- name: step 3 - Page test
mqtt_publish:
topic: hasp/{plate}/command
@ -44,7 +44,7 @@ stages:
topic: hasp/{plate}/state/page
payload: "3"
timeout: 1
delay_after: 0
- name: step 4 - Page test
mqtt_publish:
topic: hasp/{plate}/command/json
@ -53,7 +53,7 @@ stages:
topic: hasp/{plate}/state/page
payload: "1"
timeout: 1
delay_after: 0
- name: step 5 - Page test
mqtt_publish:
topic: hasp/{plate}/command/json
@ -62,6 +62,7 @@ stages:
topic: hasp/{plate}/state/page
payload: "1"
timeout: 1
delay_after: 0
---
test_name: Reboot Command
@ -76,18 +77,9 @@ paho-mqtt:
connect:
host: "{host}"
port: !int "{port:d}"
timeout: 3
auth:
username: "{username}"
password: "{password}"
timeout: 1
stages:
- name: Lower idle values
mqtt_publish:
topic: hasp/{plate}/config/gui
json:
idle1: 6
idle2: 13
- name: Test reboot command
mqtt_publish:
topic: hasp/{plate}/command/reboot
@ -96,6 +88,7 @@ stages:
topic: hasp/{plate}/LWT
payload: "offline"
timeout: 20
delay_after: 0
---
test_name: Idle States
@ -111,9 +104,6 @@ paho-mqtt:
host: "{host}"
port: !int "{port:d}"
timeout: 3
auth:
username: "{username}"
password: "{password}"
stages:
- name: Test idle
@ -122,16 +112,19 @@ stages:
payload: "wakeup"
mqtt_response:
topic: hasp/{plate}/state/idle
payload: "off"
timeout: 5
payload: "long"
timeout: 190
delay_after: 0
- name: Test idle
mqtt_publish:
topic: hasp/{plate}/command
payload: "wakeup"
mqtt_response:
topic: hasp/{plate}/state/idle
payload: "short"
timeout: 15
mqtt_response:
topic: hasp/{plate}/state/idle
payload: "long"
timeout: 30
timeout: 70
delay_after: 0
- name: Test idle
mqtt_publish:
@ -140,4 +133,5 @@ stages:
mqtt_response:
topic: hasp/{plate}/state/idle
payload: "off"
timeout: 5
timeout: 1
delay_after: 0

View File

@ -1,34 +1,6 @@
# test_page.tavern.yaml
---
test_name: Objects Standard Properties Setup
includes:
- !include config.yaml
paho-mqtt:
client:
transport: tcp
client_id: tavern-tester
connect:
host: "{host}"
port: !int "{port:d}"
timeout: 3
auth:
username: "{username}"
password: "{password}"
stages:
- name: Page 1
mqtt_publish:
topic: hasp/{plate}/command
payload: "page 1"
mqtt_response:
topic: hasp/{plate}/state/page
payload: "1"
timeout: 1
---
test_name: Objects Standard Properties Loop
test_name: Obj Standard Properties
includes:
- !include config.yaml
@ -118,11 +90,13 @@ stages:
topic: hasp/{plate}/state/page
payload: "1"
timeout: 1
delay_after: 0
- name: Clear page
mqtt_publish:
topic: hasp/{plate}/command/clearpage
payload: ""
delay_after: 0.2
- name: Create object
mqtt_publish:
@ -132,6 +106,7 @@ stages:
id: 1
x: 128
y: 128
delay_after: 0
- name: Test y
mqtt_publish:
@ -167,7 +142,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command/json
payload: '["p1b1.h={h}","p1b1.h"]'
delay_after: 0
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:
@ -178,7 +153,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command/json
payload: '["p1b1.enabled={hidden}","p1b1.enabled"]'
delay_after: 0
mqtt_response:
topic: hasp/{plate}/state/p1b1
json:
@ -189,7 +164,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.vis={hidden}"
delay_after: 0
- name: Get hidden
mqtt_publish:
topic: hasp/{plate}/command
@ -213,7 +188,7 @@ stages:
mqtt_publish:
topic: hasp/{plate}/command
payload: "p1b1.hidden={hidden}"
delay_after: 0
- name: Get hidden
mqtt_publish:
topic: hasp/{plate}/command
@ -258,7 +233,7 @@ stages:
mqtt_publish:
topic: "hasp/{plate}/command/p1b1.value_str"
payload: "{str1}{str2}"
delay_after: 0.05
- name: Get value_str
mqtt_publish:
topic: hasp/{plate}/command

View File

@ -1,34 +1,6 @@
# test_value_str.tavern.yaml
---
test_name: Value String Setup
includes:
- !include config.yaml
paho-mqtt:
client:
transport: tcp
client_id: tavern-tester
connect:
host: "{host}"
port: !int "{port:d}"
timeout: 3
auth:
username: "{username}"
password: "{password}"
stages:
- name: Page 1
mqtt_publish:
topic: hasp/{plate}/command/json
payload: '["page 1","clearpage"]'
mqtt_response:
topic: hasp/{plate}/state/page
payload: "1"
timeout: 1
---
test_name: Value String Loop
test_name: Obj Standard Properties
includes:
- !include config.yaml
@ -49,13 +21,13 @@ marks:
- parametrize:
key: obj
vals:
# - cpicker
- cpicker
- table
- tabview
- chart
- gauge
- btn
# - label
- label
- slider
- checkbox
- switch
@ -102,10 +74,15 @@ marks:
- ""
stages:
- name: Clear page
- name: Page 1
mqtt_publish:
topic: hasp/{plate}/command
payload: clearpage
payload: "page 1"
mqtt_response:
topic: hasp/{plate}/state/page
payload: "1"
timeout: 1
delay_after: 0
- name: Create object
mqtt_publish:
@ -117,11 +94,13 @@ stages:
y: 0
w: 240
h: 240
delay_after: 0
- name: Set value_str
mqtt_publish:
topic: "hasp/{plate}/command/p[1].b[1].value_str"
payload: "{str1}{str2}"
delay_after: 0
- name: Get value_str
mqtt_publish:
topic: hasp/{plate}/command

View File

@ -6,8 +6,6 @@ extra_scripts =
tools/linux_build_extra.py
build_flags =
${env.build_flags}
-D HASP_MODEL="MacOS X"
; ----- Monitor
-D TFT_WIDTH=240
-D TFT_HEIGHT=320

View File

@ -12,7 +12,6 @@ board = esp32dev
build_flags =
${env.build_flags}
${esp32.build_flags}
-D HASP_MODEL="Arduitouch"
;region -- TFT_eSPI build options ------------------------
${lcd.lolin24}

View File

@ -12,7 +12,6 @@ build_flags =
${env.build_flags}
${esp32.build_flags}
${esp32.vspi} ; Use VSPI hardware SPI bus
-D HASP_MODEL="ESP32-Touchdown"
;region -- TFT_eSPI build options ------------------------
-D USER_SETUP_LOADED=1

View File

@ -11,7 +11,6 @@ board = esp32dev
build_flags =
${env.build_flags}
${esp32.build_flags}
-D HASP_MODEL="FreeTouchDeck"
;region -- TFT_eSPI build options ------------------------
-D USER_SETUP_LOADED=1

View File

@ -12,8 +12,6 @@ board = featheresp32
build_flags =
${env.build_flags}
${esp32.build_flags}
-D HASP_MODEL="Featherwing 2.4"
;region -- TFT_eSPI build options ------------------------
${lcd.featherwing-24}
-D TFT_MISO=19

View File

@ -12,8 +12,6 @@ board = featheresp32
build_flags =
${env.build_flags}
${esp32.build_flags}
-D HASP_MODEL="Featherwing 3.5"
;region -- TFT_eSPI build options ------------------------
${lcd.featherwing-35}
-D TFT_MISO=19

View File

@ -17,7 +17,6 @@ build_flags =
${env.build_flags}
${esp32.build_flags}
${esp32.ps_ram}
-D HASP_MODEL="Lanbon L8"
;region -- TFT_eSPI build options ------------------------
${lcd.st7789v}

View File

@ -17,7 +17,6 @@ build_flags =
${env.build_flags}
${esp32.build_flags}
${esp32.ps_ram}
-D HASP_MODEL="M5Stack core2"
;region -- TFT_eSPI build options ------------------------
${lcd.m5stack}

View File

@ -17,7 +17,6 @@ build_flags =
${env.build_flags}
${esp32.build_flags}
${esp32.ps_ram}
-D HASP_MODEL="TTGO Lilygo Pi"
;region -- TFT_eSPI build options ------------------------
-D ILI9481_DRIVER=1

View File

@ -13,7 +13,6 @@ build_flags =
${env.build_flags}
${esp32.build_flags}
${esp32.ps_ram}
-D HASP_MODEL="WT32-SC01"
;region -- TFT_eSPI build options ------------------------
${lcd.wt32-sc01}

View File

@ -5,8 +5,6 @@ extra_scripts =
tools/linux_build_extra.py
build_flags =
${env.build_flags}
-D HASP_MODEL="Posix Linux"
; ----- Monitor
-D TFT_WIDTH=240
-D TFT_HEIGHT=320

View File

@ -5,8 +5,6 @@ extra_scripts =
tools/windows_build_extra.py
build_flags =
${env.build_flags}
-D HASP_MODEL="Windows"
; ----- Monitor
-D TFT_WIDTH=240
-D TFT_HEIGHT=320