diff --git a/firmware/PCB-Heater/.cproject b/firmware/PCB-Heater/.cproject
index 190ab33..3921886 100644
--- a/firmware/PCB-Heater/.cproject
+++ b/firmware/PCB-Heater/.cproject
@@ -22,7 +22,8 @@
-
+
+
@@ -100,27 +101,27 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
+
-
-
-
+
+
-
-
-
+
+
-
+
@@ -179,5 +180,12 @@
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/firmware/PCB-Heater/Core/Src/app_freertos.c b/firmware/PCB-Heater/Core/Src/app_freertos.c
index ae8c9ee..3cf5c83 100644
--- a/firmware/PCB-Heater/Core/Src/app_freertos.c
+++ b/firmware/PCB-Heater/Core/Src/app_freertos.c
@@ -161,6 +161,7 @@ static float spp; //Seconds per pixel (horizontal)
static float dpp; //Degrees per pixel (vertical)
uint16_t Timer = 0; //Time counter
static uint8_t fanActive = 0; //Fans are active flag
+static uint8_t Running = 0; //Running program flag
settings_t settings = { //settings structure
20, // uint8_t temp_offset
0, // uint8_t color_scheme
@@ -469,6 +470,10 @@ void svc_sensor(void *argument)
osMessageQueuePut(tempUpdateHandle, &res, 0, 50);
}
+ //If no program is running and T is more than 45C - turn on Fans; else - turn them off
+ if (!Running && Temperature > 50.0f) setFansSpeed(100);
+ if (!Running && Temperature <= 44.0f && fanActive) setFansSpeed(0);
+
osDelay(500);
}
/* USER CODE END svc_sensor */
@@ -526,6 +531,7 @@ void clockTick(void *argument)
stime = 0;
stemp = 20;
dps = (presets[Preset].temperature[Stage] - stemp) / (float)(presets[Preset].time[Stage]);
+ Running = 1;
}
Timer++;
@@ -537,6 +543,7 @@ void clockTick(void *argument)
ST7793_DrawStringC(Yellow, Darkergray, "Done!", 210, 5);
osMutexRelease(mutScreenHandle);
stopHeater();
+ setFansSpeed(100);
return;
}
@@ -563,7 +570,8 @@ void clockTick(void *argument)
//Calculate new aim temperature
aimTemperature = (Timer - stime) * dps + stemp;
- snprintf(str, 8, "%3d.%02d", (int)aimTemperature, (int)((aimTemperature - (int)aimTemperature)*100));
+ snprintf(str, 8, "%3.2f", aimTemperature);
+ //snprintf(str, 8, "%3d.%02d", (int)aimTemperature, (int)((aimTemperature - (int)aimTemperature)*100));
ST7793_SetFontSize(1);
ST7793_DrawString(Black, Darkergray, str, 10, 140);
@@ -573,6 +581,7 @@ void clockTick(void *argument)
PID_Update(&pid, aimTemperature, Temperature);
if (pid.out >= 0.0f) {
pulse = (uint16_t)(pid.limMax - pid.out)+20;
+ if (fanActive) setFansSpeed(0);
}
else {
pulse = 1020;
@@ -583,11 +592,16 @@ void clockTick(void *argument)
//Draw PID value
if (Screen == SCR_RUNNING) {
- snprintf(str, 7, "%3d.%02d", (int)pid.out, (int)((pid.out-(int)pid.out)*100));
+ snprintf(str, 7, "%3.2f", pid.out);
+ //snprintf(str, 7, "%3d.%02d", (int)pid.out, (int)((pid.out-(int)pid.out)*100));
osMutexAcquire(mutScreenHandle, osWaitForever);
ST7793_SetFontSize(1);
ST7793_FillRect(Darkergray, 11, 180, 27, 192);
ST7793_DrawString(Black, Darkergray, str, 11, 180);
+
+ snprintf(str, 7, "P:%4d", pulse);
+ ST7793_FillRect(Lightgray, 100, 50, 116, 62);
+ ST7793_DrawString(Black, Lightgray, str, 100, 50);
osMutexRelease(mutScreenHandle);
}
@@ -905,6 +919,7 @@ void stopHeater(void) {
aimTemperature = 0.0f;
PID_Init(&pid);
TIM1->CCR2 = 1020;
+ Running = 0;
}
/* USER CODE END Application */