[P104] Simplify SPI pin display, small formatting changes (uncrustify)

This commit is contained in:
Ton Huisman
2021-08-27 14:13:10 +02:00
parent 05a5bc714a
commit 9c789344ea
3 changed files with 37 additions and 55 deletions
+8 -27
View File
@@ -147,45 +147,26 @@ boolean Plugin_104(uint8_t function, struct EventStruct *event, String& string)
}
case PLUGIN_WEBFORM_LOAD: {
int8_t din_pin = -1;
int8_t clk_pin = -1;
int8_t spi_pins[3];
Settings.getSPI_pins(spi_pins);
int pinnr = -1;
bool input, output, warning;
# ifdef ESP32
switch (Settings.InitSPI) {
case 1:
din_pin = 23;
clk_pin = 19;
break;
case 2:
din_pin = 13;
clk_pin = 14;
break;
}
# else // ESP82xx
if (Settings.InitSPI == 1) {
din_pin = 13;
clk_pin = 14;
}
# endif // ifdef ESP32
String note;
note.reserve(72);
note = F("SPI->MAX7219: MOSI");
if (din_pin != -1) {
if (spi_pins[2] != -1) {
note += '(';
getGpioInfo(din_pin, pinnr, input, output, warning);
note += createGPIO_label(din_pin, pinnr, true, true, false);
getGpioInfo(spi_pins[2], pinnr, input, output, warning);
note += createGPIO_label(spi_pins[2], pinnr, true, true, false);
note += ')';
}
note += F("->DIN, CLK");
if (clk_pin != -1) {
if (spi_pins[0] != -1) {
note += '(';
getGpioInfo(clk_pin, pinnr, input, output, warning);
note += createGPIO_label(clk_pin, pinnr, true, true, false);
getGpioInfo(spi_pins[0], pinnr, input, output, warning);
note += createGPIO_label(spi_pins[0], pinnr, true, true, false);
note += ')';
}
note += F("->CLK");
+15 -15
View File
@@ -33,10 +33,10 @@ P104_data_struct::P104_data_struct(MD_MAX72XX::moduleType_t _mod,
uint8_t _modules,
uint8_t _zonesCount)
: mod(_mod), taskIndex(_taskIndex), cs_pin(_cs_pin), modules(_modules), expectedZones(_zonesCount) {
if (Settings.InitSPI < 1) {
addLog(LOG_LEVEL_ERROR, F("DOTMATRIX: Required SPI not enabled. Initialization aborted!"));
} else {
if (Settings.isSPI_valid()) {
P = new MD_Parola(mod, cs_pin, modules);
} else {
addLog(LOG_LEVEL_ERROR, F("DOTMATRIX: Required SPI not enabled. Initialization aborted!"));
}
}
@@ -2032,49 +2032,49 @@ bool P104_data_struct::webform_load(struct EventStruct *event) {
F("Default (0)")
# ifdef P104_USE_NUMERIC_DOUBLEHEIGHT_FONT
, F("Numeric, double height (1)")
# endif // ifdef P104_USE_NUMERIC_DOUBLEHEIGHT_FONT
# endif // ifdef P104_USE_NUMERIC_DOUBLEHEIGHT_FONT
# ifdef P104_USE_FULL_DOUBLEHEIGHT_FONT
, F("Full, double height (2)")
# endif // ifdef P104_USE_FULL_DOUBLEHEIGHT_FONT
# endif // ifdef P104_USE_FULL_DOUBLEHEIGHT_FONT
# ifdef P104_USE_VERTICAL_FONT
, F("Vertical (3)")
# endif // ifdef P104_USE_VERTICAL_FONT
# endif // ifdef P104_USE_VERTICAL_FONT
# ifdef P104_USE_EXT_ASCII_FONT
, F("Extended ASCII (4)")
# endif // ifdef P104_USE_EXT_ASCII_FONT
# ifdef P104_USE_ARABIC_FONT
, F("Arabic (5)")
# endif // ifdef P104_USE_ARABIC_FONT
# endif // ifdef P104_USE_ARABIC_FONT
# ifdef P104_USE_GREEK_FONT
, F("Greek (6)")
# endif // ifdef P104_USE_GREEK_FONT
# endif // ifdef P104_USE_GREEK_FONT
# ifdef P104_USE_KATAKANA_FONT
, F("Katakana (7)")
# endif // ifdef P104_USE_KATAKANA_FONT
# endif // ifdef P104_USE_KATAKANA_FONT
};
const int fontOptions[] = {
P104_DEFAULT_FONT_ID
# ifdef P104_USE_NUMERIC_DOUBLEHEIGHT_FONT
, P104_DOUBLE_HEIGHT_FONT_ID
# endif // ifdef P104_USE_NUMERIC_DOUBLEHEIGHT_FONT
# endif // ifdef P104_USE_NUMERIC_DOUBLEHEIGHT_FONT
# ifdef P104_USE_FULL_DOUBLEHEIGHT_FONT
, P104_FULL_DOUBLEHEIGHT_FONT_ID
# endif // ifdef P104_USE_FULL_DOUBLEHEIGHT_FONT
# endif // ifdef P104_USE_FULL_DOUBLEHEIGHT_FONT
# ifdef P104_USE_VERTICAL_FONT
, P104_VERTICAL_FONT_ID
# endif // ifdef P104_USE_VERTICAL_FONT
# endif // ifdef P104_USE_VERTICAL_FONT
# ifdef P104_USE_EXT_ASCII_FONT
, P104_EXT_ASCII_FONT_ID
# endif // ifdef P104_USE_EXT_ASCII_FONT
# ifdef P104_USE_ARABIC_FONT
, P104_ARABIC_FONT_ID
# endif // ifdef P104_USE_ARABIC_FONT
# endif // ifdef P104_USE_ARABIC_FONT
# ifdef P104_USE_GREEK_FONT
, P104_GREEK_FONT_ID
# endif // ifdef P104_USE_GREEK_FONT
# endif // ifdef P104_USE_GREEK_FONT
# ifdef P104_USE_KATAKANA_FONT
, P104_KATAKANA_FONT_ID
# endif // ifdef P104_USE_KATAKANA_FONT
# endif // ifdef P104_USE_KATAKANA_FONT
};
int layoutCount = 1;
+14 -13
View File
@@ -18,21 +18,21 @@
# include "../Helpers/StringParser.h"
# if defined(PLUGIN_SET_MAX) || defined(PLUGIN_BUILD_CUSTOM)
# define P104_USE_NUMERIC_DOUBLEHEIGHT_FONT // Enables double height numeric font for double-height time/date
# define P104_USE_NUMERIC_DOUBLEHEIGHT_FONT // Enables double height numeric font for double-height time/date
# endif // if defined(PLUGIN_SET_MAX) || defined(PLUGIN_BUILD_CUSTOM)
# define P104_USE_FULL_DOUBLEHEIGHT_FONT // Enables the use of a full (lower ascii only) set double height font
# define P104_USE_VERTICAL_FONT // Enables the use of a vertical font
# define P104_USE_EXT_ASCII_FONT // Enables the use of an extended ascii font
# define P104_USE_ARABIC_FONT // Enables the use of a Arabic font (see usage in MD_Parola examples)
# define P104_USE_GREEK_FONT // Enables the use of a Greek font (see usage in MD_Parola examples)
# define P104_USE_KATAKANA_FONT // Enables the use of a Katakana font (see usage in MD_Parola examples)
# define P104_USE_COMMANDS // Enables the use of all commands, not just clear, txt, settxt and update
# define P104_USE_DATETIME_OPTIONS // Enables extra date/time options
# define P104_USE_BAR_GRAPH // Enables the use of Bar-graph feature
# define P104_USE_ZONE_ACTIONS // Enables the use of Actions per zone (New above/New below/Delete)
# define P104_USE_ZONE_ORDERING // Enables the use of Zone ordering (Numeric order (1..n)/Display order (n..1))
# define P104_USE_FULL_DOUBLEHEIGHT_FONT // Enables the use of a full (lower ascii only) set double height font
# define P104_USE_VERTICAL_FONT // Enables the use of a vertical font
# define P104_USE_EXT_ASCII_FONT // Enables the use of an extended ascii font
# define P104_USE_ARABIC_FONT // Enables the use of a Arabic font (see usage in MD_Parola examples)
# define P104_USE_GREEK_FONT // Enables the use of a Greek font (see usage in MD_Parola examples)
# define P104_USE_KATAKANA_FONT // Enables the use of a Katakana font (see usage in MD_Parola examples)
# define P104_USE_COMMANDS // Enables the use of all commands, not just clear, txt, settxt and update
# define P104_USE_DATETIME_OPTIONS // Enables extra date/time options
# define P104_USE_BAR_GRAPH // Enables the use of Bar-graph feature
# define P104_USE_ZONE_ACTIONS // Enables the use of Actions per zone (New above/New below/Delete)
# define P104_USE_ZONE_ORDERING // Enables the use of Zone ordering (Numeric order (1..n)/Display order (n..1))
# define P104_ADD_SETTINGS_NOTES // Adds some notes on the Settings page
# define P104_ADD_SETTINGS_NOTES // Adds some notes on the Settings page
// To make it fit in the ESP8266 display build
# if defined(PLUGIN_DISPLAY_COLLECTION) && defined(ESP8266) && !defined(LIMIT_BUILD_SIZE)
@@ -99,6 +99,7 @@
# define P104_USE_TOOLTIPS // Enable tooltips in UI
# ifdef LIMIT_BUILD_SIZE
// # ifdef P104_DEBUG
// # undef P104_DEBUG
// # endif // ifdef P104_DEBUG