From 97dce525a4d1b40ffb1b64ed81bd1e08bf487b2e Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Sat, 19 Apr 2025 13:46:31 -0400 Subject: [PATCH] Graph scaling more fluid --- esp32_marauder/MenuFunctions.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp index af6c0fa..eec15c5 100644 --- a/esp32_marauder/MenuFunctions.cpp +++ b/esp32_marauder/MenuFunctions.cpp @@ -2734,10 +2734,13 @@ void MenuFunctions::setGraphScale(float scale) { } float MenuFunctions::calculateGraphScale(int16_t value) { - if (value < GRAPH_VERT_LIM) { - return 1.0; // No scaling needed if the value is within the limit + if ((value * this->_graph_scale < GRAPH_VERT_LIM) && (value * this->_graph_scale > GRAPH_VERT_LIM * 0.75)) { + return this->_graph_scale; // No scaling needed if the value is within the limit } + if (value < GRAPH_VERT_LIM) + return 1.0; + // Calculate the multiplier proportionally return (0.75 * GRAPH_VERT_LIM) / value; }