mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
generate power pulses also in soldering and sleep mode
This commit is contained in:
@@ -40,6 +40,10 @@ void startPIDTask(void const *argument);
|
|||||||
void startMOVTask(void const *argument);
|
void startMOVTask(void const *argument);
|
||||||
// End FreeRTOS
|
// End FreeRTOS
|
||||||
|
|
||||||
|
static const int maxPowerIdleTicks = 1000;
|
||||||
|
static const int powerPulseTicks = 500;
|
||||||
|
static const int powerPulseMilliWatts = 5000;
|
||||||
|
|
||||||
// Main sets up the hardware then hands over to the FreeRTOS kernel
|
// Main sets up the hardware then hands over to the FreeRTOS kernel
|
||||||
int main(void) {
|
int main(void) {
|
||||||
/* Reset of all peripherals, Initializes the Flash interface and the Systick.
|
/* Reset of all peripherals, Initializes the Flash interface and the Systick.
|
||||||
@@ -130,6 +134,7 @@ void startPIDTask(void const *argument __unused) {
|
|||||||
if (ulTaskNotifyTake(pdTRUE, 2000)) {
|
if (ulTaskNotifyTake(pdTRUE, 2000)) {
|
||||||
// This is a call to block this thread until the ADC does its samples
|
// This is a call to block this thread until the ADC does its samples
|
||||||
uint16_t rawTemp = getTipRawTemp(1); // get instantaneous reading
|
uint16_t rawTemp = getTipRawTemp(1); // get instantaneous reading
|
||||||
|
int32_t milliWattsOut = 0;
|
||||||
if (currentlyActiveTemperatureTarget) {
|
if (currentlyActiveTemperatureTarget) {
|
||||||
// Cap the max set point to 450C
|
// Cap the max set point to 450C
|
||||||
if (currentlyActiveTemperatureTarget > ctoTipMeasurement(450)) {
|
if (currentlyActiveTemperatureTarget > ctoTipMeasurement(450)) {
|
||||||
@@ -151,7 +156,6 @@ void startPIDTask(void const *argument __unused) {
|
|||||||
tempError.update(tError);
|
tempError.update(tError);
|
||||||
|
|
||||||
// Now for the PID!
|
// Now for the PID!
|
||||||
int32_t milliWattsOut = 0;
|
|
||||||
|
|
||||||
// P term - total power needed to hit target temp next cycle.
|
// P term - total power needed to hit target temp next cycle.
|
||||||
// thermal mass = 1690 milliJ/*C for my tip.
|
// thermal mass = 1690 milliJ/*C for my tip.
|
||||||
@@ -185,25 +189,19 @@ void startPIDTask(void const *argument __unused) {
|
|||||||
// basically: temp - lastTemp
|
// basically: temp - lastTemp
|
||||||
// Unfortunately, our temp signal is too noisy to really help.
|
// Unfortunately, our temp signal is too noisy to really help.
|
||||||
|
|
||||||
setTipMilliWatts(milliWattsOut);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
#ifdef MODEL_TS80
|
|
||||||
//If its a TS80, we want to have the option of using an occasional pulse to keep the power bank on
|
|
||||||
// This is purely guesswork :'( as everyone implements stuff differently
|
|
||||||
if (xTaskGetTickCount() - lastPowerPulse < 10) {
|
|
||||||
// for the first 100mS turn on for a bit
|
|
||||||
setTipMilliWatts(5000); // typically its around 5W to hold the current temp, so this wont raise temp much
|
|
||||||
} else
|
|
||||||
setTipMilliWatts(0);
|
|
||||||
//Then wait until the next 0.5 seconds
|
|
||||||
if (xTaskGetTickCount() - lastPowerPulse > 50) {
|
|
||||||
lastPowerPulse = xTaskGetTickCount();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
setTipMilliWatts(0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#ifdef MODEL_TS80
|
||||||
|
//If its a TS80, we want to have the option of using an occasional pulse to keep the power bank on
|
||||||
|
if (((xTaskGetTickCount() - lastPowerPulse) > maxPowerIdleTicks) &&
|
||||||
|
(milliWattsOut < powerPulseMilliWatts)) {
|
||||||
|
milliWattsOut = powerPulseMilliWatts;
|
||||||
|
}
|
||||||
|
if (((xTaskGetTickCount() - lastPowerPulse) > (maxPowerIdleTicks + powerPulseTicks)) &&
|
||||||
|
(milliWattsOut >= powerPulseMilliWatts)) {
|
||||||
|
lastPowerPulse = xTaskGetTickCount();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
setTipMilliWatts(milliWattsOut);
|
||||||
|
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
HAL_IWDG_Refresh(&hiwdg);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user