Pinecil v2 tune via PID (#1827)
* Start PWM after adc irq fully done * Filter len 4 * Use comparitor 2 on timer for wrap around * Update IRQ.cpp * Tip measurements are uint16_t Update BSP.cpp Update BSP.cpp * WiP PID move pid tuning to config Update PIDThread.cpp * Handle PWM Timer gitchy comparitor * Tuning * Dampen with Kd * Cleaning up * Use TemperatureType_t for getTipTemp() * Add small rolling average to user GUI temp to reduce flicker * Trigger PID when adc is skipped (will use old values)
This commit is contained in:
@@ -10,6 +10,7 @@ extern "C" {
|
||||
#include "Settings.h"
|
||||
#include "TipThermoModel.h"
|
||||
#include "Translation.h"
|
||||
#include "Types.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "configuration.h"
|
||||
#include "history.hpp"
|
||||
@@ -25,12 +26,12 @@ extern "C" {
|
||||
|
||||
// Exposed modes
|
||||
enum OperatingMode {
|
||||
idle = 0,
|
||||
soldering = 1,
|
||||
boost = 2,
|
||||
sleeping = 3,
|
||||
settings = 4,
|
||||
debug = 5
|
||||
idle = 0,
|
||||
soldering = 1,
|
||||
boost = 2,
|
||||
sleeping = 3,
|
||||
settings = 4,
|
||||
debug = 5
|
||||
};
|
||||
|
||||
// Main functions
|
||||
@@ -46,6 +47,6 @@ void drawHomeScreen(bool buttonLockout) __attribute__((noreturn)); // IDLE / Hom
|
||||
void renderHomeScreenAssets(void); // Called to act as start delay and used to render out flipped images for home screen graphics
|
||||
|
||||
// Common helpers
|
||||
int8_t getPowerSourceNumber(void); // Returns number ID of power source
|
||||
uint16_t getTipTemp(void); // Returns temperature of the tip in *C/*F (based on user settings)
|
||||
int8_t getPowerSourceNumber(void); // Returns number ID of power source
|
||||
TemperatureType_t getTipTemp(void); // Returns temperature of the tip in *C/*F (based on user settings)
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,7 @@ int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
|
||||
}
|
||||
|
||||
// draw the lcd
|
||||
uint16_t tipTemp = getTipTemp();
|
||||
TemperatureType_t tipTemp = getTipTemp();
|
||||
|
||||
OLED::clearScreen();
|
||||
OLED::setCursor(0, 0);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
void gui_drawTipTemp(bool symbol, const FontStyle font) {
|
||||
// Draw tip temp handling unit conversion & tolerance near setpoint
|
||||
uint16_t Temp = getTipTemp();
|
||||
TemperatureType_t Temp = getTipTemp();
|
||||
|
||||
OLED::printNumber(Temp, 3, font); // Draw the tip temp out
|
||||
if (symbol) {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "SolderingCommon.h"
|
||||
#include "OperatingModes.h"
|
||||
#include "configuration.h"
|
||||
#include "history.hpp"
|
||||
|
||||
extern bool heaterThermalRunaway;
|
||||
|
||||
@@ -166,4 +168,14 @@ int8_t getPowerSourceNumber(void) {
|
||||
}
|
||||
|
||||
// Returns temperature of the tip in *C/*F (based on user settings)
|
||||
uint16_t getTipTemp(void) { return getSettingValue(SettingsOptions::TemperatureInF) ? TipThermoModel::getTipInF() : TipThermoModel::getTipInC(); }
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user