Skip to content

Commit

Permalink
Fix initialization of Macro Columns setting and revery sticky temps
Browse files Browse the repository at this point in the history
The Macro Columns setting was being stored as an unsigned char
when it should have been signed.  This caused the panel to try
and display 255 columns.

Also reverted the "sticky temp" feature for now.  This feature
saved the last temp a heater was set at when it was turned off
to allow easy restoral. Unfortunately, that's different than
what the DWC does.  Will consider re-adding it with a setup
option to control it at a later date.
  • Loading branch information
George Joseph committed Aug 7, 2018
1 parent 768e48a commit 0ba9678
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/PanelDue.cpp
Expand Up @@ -146,7 +146,7 @@ struct FlashData
uint32_t colourScheme;
uint32_t brightness;
uint8_t displayDimmerType;
uint8_t macroColumns;
int8_t macroColumns;
uint8_t padding[2];
char dummy; // must be at a multiple of 4 bytes from the start because flash is read/written in whole dwords

Expand Down Expand Up @@ -236,7 +236,9 @@ bool FlashData::IsValid() const
&& brightness <= Buzzer::MaxBrightness
&& language < UI::GetNumLanguages()
&& colourScheme < NumColourSchemes
&& displayDimmerType < (uint8_t)DisplayDimmerType::NumTypes;
&& displayDimmerType < (uint8_t)DisplayDimmerType::NumTypes
&& macroColumns >= -1
&& macroColumns <= 4;
}

bool FlashData::operator==(const FlashData& other)
Expand Down Expand Up @@ -562,7 +564,7 @@ int GetBrightness()
return (int)nvData.brightness;
}

void SetMacroColumns(uint8_t columns)
void SetMacroColumns(int8_t columns)
{
nvData.macroColumns = columns;
}
Expand Down
2 changes: 1 addition & 1 deletion src/PanelDue.hpp
Expand Up @@ -59,7 +59,7 @@ extern FirmwareFeatures GetFirmwareFeatures();
extern const char* array CondStripDrive(const char* array arg);
extern void Reconnect();
extern void Delay(uint32_t milliSeconds);
extern void SetMacroColumns(uint8_t columns);
extern void SetMacroColumns(int8_t columns);
extern int GetMacroColumns();

// Global data in PanelDue.cpp that is used elsewhere
Expand Down
4 changes: 2 additions & 2 deletions src/UserInterface.cpp
Expand Up @@ -1475,7 +1475,7 @@ namespace UI
// Update an active temperature if it's valid
void UpdateActiveTemperature(size_t index, int ival)
{
if (index < MaxHeaters && ival > 0)
if (index < MaxHeaters)
{
UpdateField(activeTemps[index], ival);
}
Expand All @@ -1484,7 +1484,7 @@ namespace UI
// Update a standby temperature if it's valid
void UpdateStandbyTemperature(size_t index, int ival)
{
if (index < MaxHeaters && ival > 0)
if (index < MaxHeaters)
{
UpdateField(standbyTemps[index], ival);
}
Expand Down

0 comments on commit 0ba9678

Please sign in to comment.