Fix SPM energy display rotation in GUI

Fix SPM energy display rotation in GUI (#14281)
This commit is contained in:
Theo Arends 2022-01-04 22:30:08 +01:00
parent df58c7caea
commit d8ed99830c
1 changed files with 6 additions and 5 deletions

View File

@ -1203,14 +1203,15 @@ void SSPMEnergyShow(bool json) {
}
if (index) {
uint32_t offset = 0;
if (index > 4) {
Sspm->rotate++;
if (Sspm->rotate >= (index | 0x3)) {
Sspm->rotate = 0;
}
offset = (Sspm->rotate >> 2) * 4;
} else {
Sspm->rotate = 0;
}
if (Sspm->rotate > ((index -1) | 0x3)) { // Always test in case index has changed due to use of SspmDisplay command
Sspm->rotate = 0;
}
uint32_t offset = (Sspm->rotate >> 2) * 4;
uint32_t count = index - offset;
if (count > 4) { count = 4; }
WSContentSend_P(PSTR("</table>{t}{s}")); // First column is empty ({t} = <table style='width:100%'>, {s} = <tr><th>)