sysclk: refactor speedo code

This commit is contained in:
souldbminersmwc
2026-01-10 15:52:15 -05:00
parent 27c3a2b7c9
commit b7b6153f6e
20 changed files with 171 additions and 71 deletions

View File

@@ -259,9 +259,9 @@ void BaseMenuGui::refresh()
sprintf(displayStrings[16], "%d mW", context->power[1]); // Avg
sprintf(displayStrings[17], "%u%%", context->PartLoad[HocClkPartLoad_GPU] / 10);
sprintf(displayStrings[18], "%u%%", context->PartLoad[SysClkPartLoad_EMC] / 10);
// sprintf(displayStrings[19], "%u", context->PartLoad[HocClkPartLoad_CPUAvg]);
sprintf(displayStrings[17], "%u%%", context->partLoad[HocClkPartLoad_GPU] / 10);
sprintf(displayStrings[18], "%u%%", context->partLoad[SysClkPartLoad_EMC] / 10);
// sprintf(displayStrings[19], "%u", context->partLoad[HocClkPartLoad_CPUAvg]);
millis = context->temps[HorizonOCThermalSensor_Battery]; // Battery
sprintf(displayStrings[20], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
@@ -269,9 +269,9 @@ void BaseMenuGui::refresh()
sprintf(displayStrings[21], "%d mV", context->voltages[HocClkVoltage_Battery]); // BAT AVG
sprintf(displayStrings[23], "%u%%", context->PartLoad[HocClkPartLoad_BAT] / 1000);
sprintf(displayStrings[23], "%u%%", context->partLoad[HocClkPartLoad_BAT] / 1000);
sprintf(displayStrings[24], "%u%%", context->PartLoad[HocClkPartLoad_FAN]);
sprintf(displayStrings[24], "%u%%", context->partLoad[HocClkPartLoad_FAN]);
sprintf(displayStrings[25], "%u Hz", context->realFreqs[HorizonOCModule_Display]);

View File

@@ -40,7 +40,7 @@ void FatalGui::openWithResultCode(std::string tag, Result rc)
info.append(rcStr, snprintf(rcStr, sizeof(rcStr), "\n\n[0x%x] %04d-%04d", rc, R_MODULE(rc), R_DESCRIPTION(rc)));
tsl::changeTo<FatalGui>(
"Could not connect to Horizon OC sysmodule.\n\n"
"Could not connect to hoc-clk sysmodule.\n\n"
"\n"
"Please make sure everything is\n\n"
"correctly installed and enabled.",

View File

@@ -1,3 +1,20 @@
/*
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../format.h"
#include "fatal_gui.h"
#include "global_override_gui.h"

View File

@@ -17,14 +17,14 @@
#include "../format.h"
#include <tesla.hpp>
#include <string>
tsl::elm::ListItem* cpuSpeedoItem;
tsl::elm::ListItem* gpuSpeedoItem;
tsl::elm::ListItem* socSpeedoItem;
tsl::elm::ListItem* SpeedoItem;
tsl::elm::ListItem* IddqItem;
InfoGui::InfoGui()
{
// Initialize display strings
memset(speedoStrings, 0, sizeof(speedoStrings));
memset(strings, 0, sizeof(strings));
}
InfoGui::~InfoGui()
@@ -33,17 +33,14 @@ InfoGui::~InfoGui()
void InfoGui::listUI()
{
cpuSpeedoItem =
new tsl::elm::ListItem("CPU Speedo");
this->listElement->addItem(cpuSpeedoItem);
gpuSpeedoItem =
new tsl::elm::ListItem("GPU Speedo");
this->listElement->addItem(gpuSpeedoItem);
socSpeedoItem =
new tsl::elm::ListItem("SOC Speedo");
this->listElement->addItem(socSpeedoItem);
SpeedoItem =
new tsl::elm::ListItem("Speedos:");
this->listElement->addItem(SpeedoItem);
IddqItem =
new tsl::elm::ListItem("IDDQ:");
this->listElement->addItem(IddqItem);
}
void InfoGui::update()
@@ -58,12 +55,10 @@ void InfoGui::refresh()
if (!this->context)
return;
// Format speedo strings once per refresh
sprintf(speedoStrings[0], "%u", this->context->speedos[HorizonOCSpeedo_CPU]);
sprintf(speedoStrings[1], "%u", this->context->speedos[HorizonOCSpeedo_GPU]);
sprintf(speedoStrings[2], "%u", this->context->speedos[HorizonOCSpeedo_SOC]);
cpuSpeedoItem->setValue(speedoStrings[HorizonOCSpeedo_CPU]); // this is SO hacky but it works i guess
gpuSpeedoItem->setValue(speedoStrings[HorizonOCSpeedo_GPU]);
socSpeedoItem->setValue(speedoStrings[HorizonOCSpeedo_SOC]);
// Format strings once per refresh
sprintf(strings[0], "%u/%u/%u", this->context->speedos[HorizonOCSpeedo_CPU], this->context->speedos[HorizonOCSpeedo_GPU], this->context->speedos[HorizonOCSpeedo_SOC]);
sprintf(strings[1], "%u/%u/%u", this->context->iddq[HorizonOCSpeedo_CPU], this->context->iddq[HorizonOCSpeedo_GPU], this->context->iddq[HorizonOCSpeedo_SOC]);
SpeedoItem->setValue(strings[0]);
IddqItem->setValue(strings[1]);
}

View File

@@ -25,7 +25,7 @@
class InfoGui : public BaseMenuGui
{
protected:
char speedoStrings[3][16]; // Pre-formatted speedo strings
char strings[32][32]; // Pre-formatted strings
public:
InfoGui();

View File

@@ -16,7 +16,6 @@
*
*/
#include "misc_gui.h"
#include "fatal_gui.h"
#include "../format.h"

View File

@@ -1,3 +1,21 @@
/*
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "../../ipc.h"
#include "base_menu_gui.h"

View File

@@ -1,3 +1,21 @@
/*
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "value_choice_gui.h"
#include "../format.h"
#include "fatal_gui.h"

View File

@@ -1,3 +1,21 @@
/*
*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <list>
#include <functional>