Skip to content

Commit

Permalink
Add small rolling average to user GUI temp to reduce flicker
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralim committed Oct 16, 2023
1 parent f295b77 commit 693d013
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/Core/BSP/Pinecilv2/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
#define TIP_PID_KP 45 // Reasonable compromise for most tips so far
#define TIP_PID_KI 9 // About as high for stability across tips
#define TIP_PID_KD 200 // Helps dampen smaller tips; ~= nothing for larger tips
#define FILTER_DISPLAYED_TIP_TEMP 8 // Filtering for GUI display

#endif /* Pinecilv2 */

Expand Down
10 changes: 10 additions & 0 deletions source/Core/Threads/OperatingModes/utils/SolderingCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "SolderingCommon.h"
#include "OperatingModes.h"
#include "configuration.h"
#include "history.hpp"

extern bool heaterThermalRunaway;

Expand Down Expand Up @@ -167,5 +169,13 @@ int8_t getPowerSourceNumber(void) {

// Returns temperature of the tip in *C/*F (based on user settings)
TemperatureType_t getTipTemp(void) {
#ifdef FILTER_DISPLAYED_TIP_TEMP
static history<TemperatureType_t, FILTER_DISPLAYED_TIP_TEMP> Filter_Temp;
TemperatureType_t reading = getSettingValue(SettingsOptions::TemperatureInF) ? TipThermoModel::getTipInF() : TipThermoModel::getTipInC();
Filter_Temp.update(reading);
return Filter_Temp.average();

#else
return getSettingValue(SettingsOptions::TemperatureInF) ? TipThermoModel::getTipInF() : TipThermoModel::getTipInC();
#endif
}

0 comments on commit 693d013

Please sign in to comment.