Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions src/_P073_7DGT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
//

/** History
* 2026-01-17 tonhuisman: Revert to using 'regular' Arduino GPIO functions for TM1637 displays on ESP8266
* 2026-01-12 tonhuisman: Fix initialization of number of digits when upgrading to 20260108 build,
* formatted source with new Uncrustify config
* 2024-09-28 tonhuisman: Switch to using DIRECT_PIN_IO, to get better timing-accuracy for TM1637 displays
* 2024-09-27 tonhuisman: Add option to flash dot on second digit instead of the colon for blinking time
* 2024-08-24 tonhuisman: Add compiletime define P073_USE_74HC595_OVERRIDE that, when, set to 1, allows 74HC595 displays to be included
Expand Down Expand Up @@ -96,12 +99,13 @@

# include "src/PluginStructs/P073_data_struct.h"


boolean Plugin_073(uint8_t function, struct EventStruct *event, String& string) {
boolean success = false;

switch (function) {
case PLUGIN_DEVICE_ADD: {
switch (function)
{
case PLUGIN_DEVICE_ADD:
{
auto& dev = Device[++deviceCount];
dev.Number = PLUGIN_ID_073;
dev.Type = DEVICE_TYPE_TRIPLE;
Expand All @@ -113,13 +117,15 @@ boolean Plugin_073(uint8_t function, struct EventStruct *event, String& string)
break;
}

case PLUGIN_GET_DEVICENAME: {
case PLUGIN_GET_DEVICENAME:
{
string = F(PLUGIN_NAME_073);
break;
}

# if P073_SCROLL_TEXT || P073_USE_74HC595
case PLUGIN_SET_DEFAULTS: {
case PLUGIN_SET_DEFAULTS:
{
# if P073_SCROLL_TEXT
P073_CFG_SCROLLSPEED = 10; // Default 10 * 0.1 sec scroll speed
# endif // if P073_SCROLL_TEXT
Expand All @@ -134,7 +140,8 @@ boolean Plugin_073(uint8_t function, struct EventStruct *event, String& string)
}
# endif // if P073_SCROLL_TEXT || P073_USE_74HC595

case PLUGIN_WEBFORM_LOAD: {
case PLUGIN_WEBFORM_LOAD:
{
addFormNote(F("TM1637: 1st=CLK-Pin, 2nd=DIO-Pin"));
addFormNote(F("MAX7219: 1st=DIN-Pin, 2nd=CLK-Pin, 3rd=CS-Pin"));
# if P073_USE_74HC595
Expand All @@ -151,7 +158,7 @@ boolean Plugin_073(uint8_t function, struct EventStruct *event, String& string)
};
constexpr size_t optionCount = NR_ELEMENTS(displtype);
const FormSelectorOptions selector(optionCount, displtype);
selector.addFormSelector(F("Display Type"), F("displtype"), PCONFIG(0));
selector.addFormSelector(F("Display Type"), F("displtype"), P073_CFG_DISPLAYTYPE);
}
# if P073_USE_74HC595

Expand Down Expand Up @@ -258,7 +265,8 @@ boolean Plugin_073(uint8_t function, struct EventStruct *event, String& string)
break;
}

case PLUGIN_WEBFORM_SAVE: {
case PLUGIN_WEBFORM_SAVE:
{
P073_CFG_DISPLAYTYPE = getFormItemInt(F("displtype"));
P073_CFG_OUTPUTTYPE = getFormItemInt(F("displout"));
P073_CFG_BRIGHTNESS = getFormItemInt(F("brightness"));
Expand Down Expand Up @@ -292,12 +300,14 @@ boolean Plugin_073(uint8_t function, struct EventStruct *event, String& string)
break;
}

case PLUGIN_EXIT: {
case PLUGIN_EXIT:
{
success = true;
break;
}

case PLUGIN_INIT: {
case PLUGIN_INIT:
{
initPluginTaskData(event->TaskIndex, new (std::nothrow) P073_data_struct());
P073_data_struct *P073_data =
static_cast<P073_data_struct *>(getPluginTaskData(event->TaskIndex));
Expand All @@ -317,7 +327,8 @@ boolean Plugin_073(uint8_t function, struct EventStruct *event, String& string)
break;
}

case PLUGIN_WRITE: {
case PLUGIN_WRITE:
{
P073_data_struct *P073_data =
static_cast<P073_data_struct *>(getPluginTaskData(event->TaskIndex));

Expand All @@ -327,7 +338,8 @@ boolean Plugin_073(uint8_t function, struct EventStruct *event, String& string)
break;
}

case PLUGIN_ONCE_A_SECOND: {
case PLUGIN_ONCE_A_SECOND:
{
P073_data_struct *P073_data =
static_cast<P073_data_struct *>(getPluginTaskData(event->TaskIndex));

Expand All @@ -339,7 +351,8 @@ boolean Plugin_073(uint8_t function, struct EventStruct *event, String& string)
}

# if P073_SCROLL_TEXT
case PLUGIN_TEN_PER_SECOND: {
case PLUGIN_TEN_PER_SECOND:
{
P073_data_struct *P073_data =
static_cast<P073_data_struct *>(getPluginTaskData(event->TaskIndex));

Expand All @@ -353,7 +366,8 @@ boolean Plugin_073(uint8_t function, struct EventStruct *event, String& string)

# if P073_USE_74HC595

case PLUGIN_TASKTIMER_IN: {
case PLUGIN_TASKTIMER_IN:
{
P073_data_struct *P073_data =
static_cast<P073_data_struct *>(getPluginTaskData(event->TaskIndex));

Expand Down
3 changes: 2 additions & 1 deletion src/_P135_SCD4x.ino
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ boolean Plugin_135(uint8_t function, struct EventStruct *event, String& string)
case PLUGIN_GET_DISCOVERY_VTYPES:
{
event->Par1 = static_cast<int>(Sensor_VType::SENSOR_TYPE_CO2_ONLY);
event->Par2 = static_cast<int>(Sensor_VType::SENSOR_TYPE_TEMP_HUM);
event->Par2 = static_cast<int>(Sensor_VType::SENSOR_TYPE_HUM_ONLY);
event->Par3 = static_cast<int>(Sensor_VType::SENSOR_TYPE_TEMP_ONLY);
success = true;
break;
}
Expand Down
7 changes: 4 additions & 3 deletions src/src/Globals/Plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1013,9 +1013,10 @@ bool PluginCall(uint8_t Function, struct EventStruct *event, String& str)
case PLUGIN_GET_UOM_GROUPS:
#endif // if FEATURE_TASKVALUE_UNIT_OF_MEASURE

// PLUGIN_MQTT_xxx functions are directly called from the scheduler.
// case PLUGIN_MQTT_CONNECTION_STATE:
// case PLUGIN_MQTT_IMPORT:
#if FEATURE_MQTT
case PLUGIN_MQTT_CONNECTION_STATE:
case PLUGIN_MQTT_IMPORT:
#endif // if FEATURE_MQTT
{
START_TIMER;
const deviceIndex_t DeviceIndex = getDeviceIndex_from_TaskIndex(event->TaskIndex);
Expand Down
9 changes: 2 additions & 7 deletions src/src/Helpers/PeriodicalActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,6 @@ void scheduleNextMQTTdelayQueue() {
}

void schedule_all_MQTTimport_tasks() {
controllerIndex_t ControllerIndex = firstEnabledMQTT_ControllerIndex();

if (!validControllerIndex(ControllerIndex)) { return; }

constexpr pluginID_t PLUGIN_MQTT_IMPORT(PLUGIN_ID_MQTT_IMPORT);

deviceIndex_t DeviceIndex = getDeviceIndex(PLUGIN_MQTT_IMPORT); // Check if P037_MQTTimport is present in the build
Expand Down Expand Up @@ -420,9 +416,6 @@ void updateMQTTclient_connected() {
addLogMove(LOG_LEVEL_ERROR, connectionError);
}
MQTTclient_must_send_LWT_connected = false;
} else {
// Now schedule all tasks using the MQTT controller.
schedule_all_MQTTimport_tasks();
}
if (Settings.UseRules) {
if (MQTTclient_connected) {
Expand All @@ -431,6 +424,8 @@ void updateMQTTclient_connected() {
eventQueue.add(F("MQTT#Disconnected"));
}
}
// Now schedule all tasks using the MQTT Import plugin.
schedule_all_MQTTimport_tasks();
}
if (!MQTTclient_connected) {
// As suggested here: https://github.com/letscontrolit/ESPEasy/issues/1356
Expand Down
1 change: 0 additions & 1 deletion src/src/PluginStructs/P023_data_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ void P023_data_struct::sendStrXY(const char *string, int X, int Y) {
for (i = 0; i < char_width && currentPixels < maxPixels; ++i,++currentPixels) { // Prevent display overflow on the pixel-level
sendChar((i == 0 || i > 5) ? 0x00 : pgm_read_byte(baddr + i - 1));
}
currentPixels += char_width;
string++;
}
}
Expand Down
Loading
Loading