1
0
forked from me/IronOS

Rough refactor main control loop to C

This commit is contained in:
Ben V. Brown
2019-10-07 18:58:51 +11:00
parent c5f6f6d044
commit 1cf88b2cd6
11 changed files with 233 additions and 496 deletions

View File

@@ -11,7 +11,7 @@
#define SETTINGS_H_
#include <stdint.h>
#include "stm32f1xx_hal.h"
#define SETTINGSVERSION ( 0x19 )
#define SETTINGSVERSION ( 0x1A )
/*Change this if you change the struct below to prevent people getting \
out of sync*/
@@ -39,7 +39,7 @@ typedef struct {
uint8_t descriptionScrollSpeed :1; // Description scroll speed
uint16_t voltageDiv; // Voltage divisor factor
uint16_t BoostTemp; // Boost mode set point for the iron
int16_t CalibrationOffset; // This stores the temperature offset for this tip
uint16_t CalibrationOffset; // This stores the temperature offset for this tip
// in the iron.
uint8_t PID_P; // PID P Term
uint8_t PID_I; // PID I Term
@@ -47,7 +47,6 @@ typedef struct {
uint8_t version; // Used to track if a reset is needed on firmware upgrade
uint8_t customTipGain; // Tip gain value if custom tuned, or 0 if using a
// tipType param
uint8_t tipType;
#ifdef MODEL_TS80
uint8_t pidPowerLimit;
#endif

View File

@@ -5,7 +5,7 @@
#include "OLED.hpp"
#include "Setup.h"
extern uint8_t PCBVersion;
extern uint32_t currentlyActiveTemperatureTarget;
extern uint32_t currentTempTargetDegC;
enum ButtonState {
BUTTON_NONE = 0, /* No buttons pressed / < filter time*/
BUTTON_F_SHORT = 1, /* User has pressed the front button*/

View File

@@ -30,7 +30,7 @@ const uint8_t tipResistance = 45; //x10 ohms, 8.5 typical for ts100, 4.5 typical
const uint8_t oscillationPeriod = 6 * PID_TIM_HZ; // I term look back value
extern history<uint32_t, oscillationPeriod> milliWattHistory;
int32_t tempToMilliWatts(int32_t rawTemp, uint8_t rawC);
int32_t tempToMilliWatts(int32_t rawTemp);
void setTipMilliWatts(int32_t mw);
uint8_t milliWattsToPWM(int32_t milliWatts, uint8_t divisor,
uint8_t sample = 0);