mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-28 04:07:47 +00:00
[P104] Bugfixes and improvements
This commit is contained in:
@@ -62,6 +62,7 @@
|
||||
// Up to 8 graphStrings can be provided, width is determined by the number of graphStrings
|
||||
//
|
||||
// History:
|
||||
// 2021-07-08 tonhuisman: Several bugfixes: settings defaults, fix brightness to enable 0 value, simplify storing the zone settings
|
||||
// 2021-06-29-2021-07-03: Add Actions column to insert before/after zone or delete a zone, order the zones either in numeric order
|
||||
// tonhuisman: or in display order ('upside-down'), fixed many bugs, refactored bar-graph method, other improvements
|
||||
// All optional at compile-time by P104_USE_ZONE_ACTIONS and P104_USE_ZONE_ORDERING
|
||||
|
||||
@@ -115,7 +115,7 @@ void P104_data_struct::loadSettings() {
|
||||
|
||||
int16_t offset2;
|
||||
uint16_t prev2 = 0;
|
||||
String tmp, fld, tmp_val;
|
||||
String tmp, fld;
|
||||
int tmp_int;
|
||||
offset2 = buffer.indexOf(P104_ZONE_SEP);
|
||||
|
||||
@@ -175,19 +175,11 @@ void P104_data_struct::loadSettings() {
|
||||
zones[zoneIndex].offset = tmp_int;
|
||||
}
|
||||
|
||||
tmp_val = parseString(tmp, 1 + P104_OFFSET_BRIGHTNESS, P104_FIELD_SEP);
|
||||
|
||||
if (tmp_val.isEmpty() || !validIntFromString(tmp_val, tmp_int)) {
|
||||
zones[zoneIndex].brightness = 7;
|
||||
} else {
|
||||
if (validIntFromString(parseString(tmp, 1 + P104_OFFSET_BRIGHTNESS, P104_FIELD_SEP), tmp_int)) {
|
||||
zones[zoneIndex].brightness = tmp_int;
|
||||
}
|
||||
|
||||
tmp_val = parseString(tmp, 1 + P104_OFFSET_REPEATDELAY, P104_FIELD_SEP);
|
||||
|
||||
if (tmp_val.isEmpty() || !validIntFromString(tmp_val, tmp_int)) {
|
||||
zones[zoneIndex].repeatDelay = -1;
|
||||
} else {
|
||||
if (validIntFromString(parseString(tmp, 1 + P104_OFFSET_REPEATDELAY, P104_FIELD_SEP), tmp_int)) {
|
||||
zones[zoneIndex].repeatDelay = tmp_int;
|
||||
}
|
||||
|
||||
@@ -1298,7 +1290,7 @@ void P104_data_struct::checkRepeatTimer(uint8_t z) {
|
||||
/******************************************
|
||||
* enquoteString wrap in ", ' or ` unless all 3 quote types are used
|
||||
*****************************************/
|
||||
String enquoteString(const String& input) {
|
||||
String P104_data_struct::enquoteString(const String& input) {
|
||||
char quoteChar = '"';
|
||||
|
||||
if (input.indexOf(quoteChar) > -1) {
|
||||
@@ -1449,19 +1441,9 @@ bool P104_data_struct::saveSettings() {
|
||||
zbuffer += P104_FIELD_SEP; // 1
|
||||
zbuffer += it->offset; // 2
|
||||
zbuffer += P104_FIELD_SEP; // 1
|
||||
|
||||
if (it->brightness != 7) {
|
||||
zbuffer += it->brightness; // 2
|
||||
} else {
|
||||
zbuffer += 'i'; // Invalid so will be read as default
|
||||
}
|
||||
zbuffer += it->brightness; // 2
|
||||
zbuffer += P104_FIELD_SEP; // 1
|
||||
|
||||
if (it->repeatDelay > -1) {
|
||||
zbuffer += it->repeatDelay; // 4
|
||||
} else {
|
||||
zbuffer += 'i'; // Invalid so will be read as default
|
||||
}
|
||||
zbuffer += it->repeatDelay; // 4
|
||||
zbuffer += P104_FIELD_SEP; // 1
|
||||
|
||||
zbuffer += P104_ZONE_SEP; // 1
|
||||
@@ -2134,7 +2116,7 @@ bool P104_data_struct::webform_load(struct EventStruct *event) {
|
||||
|
||||
html_TD(); // Brightness
|
||||
|
||||
if (zones[zone].brightness == 0) { zones[zone].brightness = 7; }
|
||||
if (zones[zone].brightness == -1) { zones[zone].brightness = 7; }
|
||||
addNumericBox(getPluginCustomArgName(index + P104_OFFSET_BRIGHTNESS), zones[zone].brightness, 0, P104_BRIGHTNESS_MAX);
|
||||
|
||||
html_TD(); // Repeat (sec)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifdef USES_P104
|
||||
|
||||
# define P104_DEBUG // Log some extra (tech) data, also useful during development
|
||||
// # define P104_DEBUG_DEV // Log some extra development info
|
||||
# define P104_DEBUG_DEV // Log some extra development info
|
||||
|
||||
# include "../CustomBuild/StorageLayout.h"
|
||||
# include "src/Globals/EventQueue.h"
|
||||
@@ -294,7 +294,7 @@
|
||||
struct P104_zone_struct {
|
||||
P104_zone_struct(uint8_t _zone) : zone(_zone) {
|
||||
size = 0u;
|
||||
text = F("");
|
||||
text = F("\"\"");
|
||||
alignment = 0u;
|
||||
animationIn = 1u; // Doesn't allow 'None'
|
||||
speed = 0u;
|
||||
@@ -305,7 +305,7 @@ struct P104_zone_struct {
|
||||
layout = 0u;
|
||||
specialEffect = 0u;
|
||||
offset = 0u;
|
||||
brightness = 7u;
|
||||
brightness = -1;
|
||||
repeatDelay = -1;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ struct P104_zone_struct {
|
||||
uint8_t layout;
|
||||
uint8_t specialEffect;
|
||||
uint8_t offset;
|
||||
uint8_t brightness;
|
||||
int8_t brightness;
|
||||
uint16_t speed, pause;
|
||||
int32_t repeatDelay;
|
||||
uint32_t _repeatTimer;
|
||||
@@ -400,9 +400,10 @@ private:
|
||||
uint8_t row);
|
||||
# endif // ifdef P104_USE_BAR_GRAPH
|
||||
|
||||
void displayOneZoneText(uint8_t currentZone,
|
||||
const P104_zone_struct& idx,
|
||||
const String & text);
|
||||
void displayOneZoneText(uint8_t currentZone,
|
||||
const P104_zone_struct& idx,
|
||||
const String & text);
|
||||
String enquoteString(const String& input);
|
||||
|
||||
MD_MAX72XX::moduleType_t mod;
|
||||
taskIndex_t taskIndex;
|
||||
|
||||
Reference in New Issue
Block a user