Skip to content
Open
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
20 changes: 4 additions & 16 deletions src/_P054_DMX512.ino
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ boolean Plugin_054(uint8_t function, struct EventStruct *event, String& string)
case PLUGIN_DEVICE_ADD:
{
auto& dev = Device[++deviceCount];
dev.Number = PLUGIN_ID_054;
dev.Type = DEVICE_TYPE_SERIAL;
dev.VType = Sensor_VType::SENSOR_TYPE_NONE;
dev.Number = PLUGIN_ID_054;
dev.Type = DEVICE_TYPE_SERIAL;
dev.VType = Sensor_VType::SENSOR_TYPE_NONE;
dev.SerialPortsAllowed = INCLUDE_HW_SERIAL | INCLUDE_SW_SERIAL;
break;
}

Expand Down Expand Up @@ -133,19 +134,6 @@ boolean Plugin_054(uint8_t function, struct EventStruct *event, String& string)
break;
}

case PLUGIN_WEBFORM_SHOW_SERIAL_PARAMS:
{
addFormNote(F("An on-chip ESP Serial port"
# if USES_USBCDC
" (<B>not</B> USB CDC)"
# endif // if USES_USBCDC
# if USES_HWCDC
" (<B>not</B> USB HWCDC)"
# endif // if USES_HWCDC
" must be selected!"));
break;
}

case PLUGIN_GET_DEVICEGPIONAMES:
{
serialHelper_getGpioNames(event, true);
Expand Down
13 changes: 5 additions & 8 deletions src/_P065_DRF0299_MP3.ino
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
ESPeasySerial *P065_easySerial = nullptr;
uint8_t P065_initialVolumeSet = P065_VOLUME_DELAY;


boolean Plugin_065(uint8_t function, struct EventStruct *event, String& string)
{
boolean success = false;
Expand All @@ -63,9 +62,10 @@ boolean Plugin_065(uint8_t function, struct EventStruct *event, String& string)
case PLUGIN_DEVICE_ADD:
{
auto& dev = Device[++deviceCount];
dev.Number = PLUGIN_ID_065;
dev.Type = DEVICE_TYPE_SERIAL;
dev.VType = Sensor_VType::SENSOR_TYPE_NONE;
dev.Number = PLUGIN_ID_065;
dev.Type = DEVICE_TYPE_SERIAL;
dev.VType = Sensor_VType::SENSOR_TYPE_NONE;
dev.SerialPortsAllowed = INCLUDE_NOT_CDC_SERIAL;
break;
}

Expand Down Expand Up @@ -274,10 +274,7 @@ void Plugin_065_SetMode(int8_t mode)
Plugin_065_SendCmd(0x08, mode);
}

void Plugin_065_SetRepeat(int8_t repeat)
{
Plugin_065_SendCmd(0x11, (repeat <= 0) ? 0 : 1);
}
void Plugin_065_SetRepeat(int8_t repeat) { Plugin_065_SendCmd(0x11, (repeat <= 0) ? 0 : 1); }

void Plugin_065_SendCmd(uint8_t cmd, int16_t data)
{
Expand Down
25 changes: 13 additions & 12 deletions src/_P077_CSE7766.ino
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,19 @@ boolean Plugin_077(uint8_t function, struct EventStruct *event, String& string)
switch (function) {
case PLUGIN_DEVICE_ADD: {
auto& dev = Device[++deviceCount];
dev.Number = PLUGIN_ID_077;
dev.Type = DEVICE_TYPE_SERIAL;
dev.VType = Sensor_VType::SENSOR_TYPE_QUAD;
dev.FormulaOption = true;
dev.ValueCount = 4;
dev.OutputDataType = Output_Data_type_t::Simple;
dev.SendDataOption = true;
dev.TimerOption = true;
dev.TimerOptional = true;
dev.PluginStats = true;
dev.TaskLogsOwnPeaks = true;
dev.MqttStateClass = true;
dev.Number = PLUGIN_ID_077;
dev.Type = DEVICE_TYPE_SERIAL;
dev.VType = Sensor_VType::SENSOR_TYPE_QUAD;
dev.FormulaOption = true;
dev.ValueCount = 4;
dev.OutputDataType = Output_Data_type_t::Simple;
dev.SendDataOption = true;
dev.TimerOption = true;
dev.TimerOptional = true;
dev.PluginStats = true;
dev.TaskLogsOwnPeaks = true;
dev.MqttStateClass = true;
dev.SerialPortsAllowed = INCLUDE_HW_SERIAL;
break;
}

Expand Down
1 change: 1 addition & 0 deletions src/_P159_LD2410.ino
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ boolean Plugin_159(uint8_t function, struct EventStruct *event, String& string)
dev.PluginStats = true;
dev.ExitTaskBeforeSave = false; // Enable calling PLUGIN_WEBFORM_SAVE on the instantiated object
dev.CustomVTypeVar = true;
dev.SerialPortsAllowed = INCLUDE_NOT_CDC_SERIAL;

break;
}
Expand Down
3 changes: 2 additions & 1 deletion src/src/DataStructs/DeviceStruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ DeviceStruct::DeviceStruct() :
OutputDataType(Output_Data_type_t::Default),
Pin1Direction(static_cast<uint8_t>(gpio_direction::gpio_direction_MAX)),
Pin2Direction(static_cast<uint8_t>(gpio_direction::gpio_direction_MAX)),
Pin3Direction(static_cast<uint8_t>(gpio_direction::gpio_direction_MAX))
Pin3Direction(static_cast<uint8_t>(gpio_direction::gpio_direction_MAX)),
SerialPortsAllowed(INCLUDE_DEFAULT_SERIAL)
{
// Only initialize union members in the constructor body
// TODO: Rename this so it can be default initialized to 'false'
Expand Down
3 changes: 2 additions & 1 deletion src/src/DataStructs/DeviceStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "../DataTypes/SensorVType.h"

#include "../Helpers/StringGenerator_GPIO.h"
#include "../Helpers/_Plugin_Helper_serial.h"


#define DEVICE_TYPE_SINGLE 1 // connected through 1 datapin
Expand Down Expand Up @@ -154,7 +155,7 @@ struct DeviceStruct
uint8_t PinDirection_unused : GPIO_DIRECTION_NR_BITS;
};
};
uint8_t Unused{}; // Padding to 12 bytes struct size
uint8_t SerialPortsAllowed = INCLUDE_DEFAULT_SERIAL; // The bitmap for the allowed serial port types, uses global default
};


Expand Down
6 changes: 3 additions & 3 deletions src/src/WebServer/DevicesPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ void handle_devices_TaskSettingsPage(taskIndex_t taskIndex, uint8_t page)
) {
if (device.isSerial()) {
# ifdef PLUGIN_USES_SERIAL
devicePage_show_serial_config(taskIndex);
devicePage_show_serial_config(taskIndex, DeviceIndex);
# else // ifdef PLUGIN_USES_SERIAL
addHtml(F("PLUGIN_USES_SERIAL not defined"));
# endif // ifdef PLUGIN_USES_SERIAL
Expand Down Expand Up @@ -1424,15 +1424,15 @@ void devicePage_show_pin_config(taskIndex_t taskIndex, deviceIndex_t DeviceIndex

# ifdef PLUGIN_USES_SERIAL

void devicePage_show_serial_config(taskIndex_t taskIndex)
void devicePage_show_serial_config(taskIndex_t taskIndex, deviceIndex_t DeviceIndex)
{
struct EventStruct TempEvent(taskIndex);

String webformLoadString;

PluginCall(PLUGIN_WEBFORM_PRE_SERIAL_PARAMS, &TempEvent, webformLoadString);

serialHelper_webformLoad(&TempEvent);
serialHelper_webformLoad(&TempEvent, Device[DeviceIndex].SerialPortsAllowed);

PluginCall(PLUGIN_WEBFORM_SHOW_SERIAL_PARAMS, &TempEvent, webformLoadString);
}
Expand Down
2 changes: 1 addition & 1 deletion src/src/WebServer/DevicesPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void handle_devices_TaskSettingsPage(taskIndex_t taskIndex, uint8_t page);
void devicePage_show_pin_config(taskIndex_t taskIndex, deviceIndex_t DeviceIndex);

#ifdef PLUGIN_USES_SERIAL
void devicePage_show_serial_config(taskIndex_t taskIndex);
void devicePage_show_serial_config(taskIndex_t taskIndex, deviceIndex_t DeviceIndex);
#endif

#if FEATURE_SPI
Expand Down