Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions src/_P137_AXP192.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

/**
* Changelog:
* 2025-01-18 tonhuisman: Add predefined config settings for M5Stack StickC Plus units
* 2022-12-27 tonhuisman: Add predefined config settings for LilyGO T-Beam LoRa units
* 2022-12-07 tonhuisman: Re-order device configuration to use PLUGIN_WEBFORM_LOAD_OUTPUT_SELECTOR
* Enable PluginStats feature
Expand Down Expand Up @@ -181,13 +182,15 @@ boolean Plugin_137(uint8_t function, struct EventStruct *event, String& string)
toString(P137_PredefinedDevices_e::M5Stack_StickC),
toString(P137_PredefinedDevices_e::M5Stack_Core2),
toString(P137_PredefinedDevices_e::LilyGO_TBeam),
toString(P137_PredefinedDevices_e::M5Stack_StickCPlus),
toString(P137_PredefinedDevices_e::UserDefined) // keep last and at 99 !!
};
const int predefinedValues[] = {
static_cast<int>(P137_PredefinedDevices_e::Unselected),
static_cast<int>(P137_PredefinedDevices_e::M5Stack_StickC),
static_cast<int>(P137_PredefinedDevices_e::M5Stack_Core2),
static_cast<int>(P137_PredefinedDevices_e::LilyGO_TBeam),
static_cast<int>(P137_PredefinedDevices_e::M5Stack_StickCPlus),
static_cast<int>(P137_PredefinedDevices_e::UserDefined) }; // keep last and at 99 !!
constexpr size_t optionCount = NR_ELEMENTS(predefinedValues);
addFormSelector(F("Predefined device configuration"), F("predef"),
Expand Down
9 changes: 9 additions & 0 deletions src/src/PluginStructs/P137_data_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ void P137_CheckPredefinedParameters(struct EventStruct *event) {
P137_CONFIG_DISABLEBITS = 0b1111111000; // NC pins disabled
break;
}
case P137_PredefinedDevices_e::M5Stack_StickCPlus: // M5Stack StickC Plus
{
P137_REG_DCDC2_LDO2 = (P137_valueToSetting(-1, P137_CONST_MAX_DCDC2) << 16) | P137_valueToSetting(2800, P137_CONST_MAX_LDO);
P137_REG_DCDC3_LDO3 = (P137_valueToSetting(-1, P137_CONST_MAX_DCDC) << 16) | P137_valueToSetting(3000, P137_CONST_MAX_LDO);
P137_REG_LDOIO = P137_valueToSetting(2800, P137_CONST_MAX_LDOIO);
P137_CONFIG_DISABLEBITS = 0b1111110000; // NC pins disabled
break;
}
case P137_PredefinedDevices_e::UserDefined: // User defined
{
P137_REG_DCDC2_LDO2 = (P137_valueToSetting(-1, P137_CONST_MAX_DCDC2) << 16) | P137_valueToSetting(3300, P137_CONST_MAX_LDO);
Expand Down Expand Up @@ -137,6 +145,7 @@ const __FlashStringHelper* toString(const P137_PredefinedDevices_e device) {
case P137_PredefinedDevices_e::M5Stack_StickC: return F("M5Stack StickC");
case P137_PredefinedDevices_e::M5Stack_Core2: return F("M5Stack Core2 (Default)");
case P137_PredefinedDevices_e::LilyGO_TBeam: return F("LilyGO T-Beam");
case P137_PredefinedDevices_e::M5Stack_StickCPlus: return F("M5Stack StickC Plus");
case P137_PredefinedDevices_e::UserDefined: return F("User defined");
}
return F("*Undefined*");
Expand Down
11 changes: 6 additions & 5 deletions src/src/PluginStructs/P137_data_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ enum class P137_GPIOBootState_e: uint8_t { // Will be applied by subtracting 1 !
};

enum class P137_PredefinedDevices_e : uint8_t {
Unselected = 0u,
M5Stack_StickC = 1u,
M5Stack_Core2 = 2u,
LilyGO_TBeam = 3u,
UserDefined = 99u // Keep as last
Unselected = 0u,
M5Stack_StickC = 1u,
M5Stack_Core2 = 2u,
LilyGO_TBeam = 3u,
M5Stack_StickCPlus = 4u,
UserDefined = 99u // Keep as last
};

int16_t P137_settingToValue(uint16_t data,
Expand Down