Skip to content
3 changes: 2 additions & 1 deletion src/_P036_FrameOLED.ino
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ boolean Plugin_036(uint8_t function, struct EventStruct *event, String& string)
const int optionValues[] =
{ static_cast<int>(p036_resolution::pix128x64),
static_cast<int>(p036_resolution::pix128x32),
static_cast<int>(p036_resolution::pix64x48) };
static_cast<int>(p036_resolution::pix64x48),
static_cast<int>(p036_resolution::pix72x40) };
OLedFormSizes(F("size"), optionValues, P036_RESOLUTION, true);
}

Expand Down
5 changes: 3 additions & 2 deletions src/src/Helpers/OLed_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ void OLedFormSizes(const __FlashStringHelper *id,
const __FlashStringHelper *options3[] = {
F("128x64"),
F("128x32"),
F("64x48") };
F("64x48"),
F("72x40") };
FormSelectorOptions selector(NR_ELEMENTS(options3), options3, values);
Comment on lines +73 to 75
Copy link
Copy Markdown
Contributor

@tonhuisman tonhuisman May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of the way this is constructed, this will crash when configuring the display configuration in P023, as that plugin won't provide the 4th option value.
I think the number of items to display in the selector will have to be added as a new argument to the function, can default to 3, for 'other plugins using this function', and from P036 a value of 4 should be provided (or the length of the values array, like NR_ELEMENTS(optionValues)).

Copy link
Copy Markdown
Contributor

@tonhuisman tonhuisman May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, you can change the signature for the function, having const int values[] (also in the .h file), and take the NR_ELEMENTS(values) instead of NR_ELEMENTS(options3), that would be an easier change 😉

selector.reloadonchange = reloadOnChange;
selector.addFormSelector(
Expand Down Expand Up @@ -128,4 +129,4 @@ bool OLedI2CAddressCheck(uint8_t function,
}
return success;
}
#endif
#endif
8 changes: 8 additions & 0 deletions src/src/PluginStructs/P036_data_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ constexpr tSizeSettings SizeSettings[] = {
{ 64, 48, 32, // 64x48
3, // max. line count
32, 10 // WiFi indicator
},
{ 72, 40, 28, // 72x40
3, // max. line count
28, 12 // WiFi indicator
}
};

Expand Down Expand Up @@ -1164,6 +1168,8 @@ tIndividualFontSettings P036_data_struct::CalculateIndividualFontSettings(uint8_
break;
case p036_resolution::pix128x32: lSpace = -2;
break;
case p036_resolution::pix72x40: lSpace = -1;
break;
case p036_resolution::pix64x48: lSpace = -1;
break;
}
Expand Down Expand Up @@ -1310,6 +1316,8 @@ tFontSettings P036_data_struct::CalculateFontSettings(uint8_t lDefaultLines) {
break;
case p036_resolution::pix64x48: result.Space = -1;
break;
case p036_resolution::pix72x40: result.Space = -1;
break;
}
iFontIndex = NR_ELEMENTS(FontSizes) - 1;
}
Expand Down
3 changes: 2 additions & 1 deletion src/src/PluginStructs/P036_data_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ enum class eHeaderContent : uint8_t {
enum class p036_resolution : uint8_t {
pix128x64 = 0u,
pix128x32 = 1u,
pix64x48 = 2u
Comment thread
TD-er marked this conversation as resolved.
pix64x48 = 2u,
pix72x40 = 3u,
};

enum class ePageScrollSpeed : uint8_t {
Expand Down