@@ -45,10 +45,7 @@ uint8_t fw_version_minor = 2;
45
45
uint8_t fw_version_patch = 1 ;
46
46
47
47
//#define PID_TUNING
48
- #define DEBUG
49
- #ifdef DEBUG
50
- DEBUG_VERBOSITY_t debugLevel = DEBUG_INFO ;
51
- #endif
48
+ DEBUG_VERBOSITY_t debugLevel = DEBUG_INFO ;
52
49
53
50
/* PID parameters */
54
51
#define KP_NT115 5
@@ -290,11 +287,12 @@ Flash_values default_flash_values = {.startup_temperature = 330,
290
287
.temp_cal_300 = 300 ,
291
288
.temp_cal_350 = 350 ,
292
289
.temp_cal_400 = 400 ,
293
- .temp_cal_450 = 450 };
290
+ .temp_cal_450 = 450 ,
291
+ .serial_debug_print = 0 };
294
292
295
293
/* List of names for settings menu */
296
- #define menu_length 23
297
- char menu_names [menu_length ][28 ] = { "Startup Temp °C " ,
294
+ #define menu_length 24
295
+ char menu_names [menu_length ][29 ] = { "Startup Temp °C " ,
298
296
"Temp Offset °C " ,
299
297
"Standby Temp °C " ,
300
298
"Standby Time [min] " ,
@@ -314,6 +312,7 @@ char menu_names[menu_length][28] = { "Startup Temp °C ",
314
312
"Temp cal 350 " ,
315
313
"Temp cal 400 " ,
316
314
"Temp cal 450 " ,
315
+ "Serial DEBUG " ,
317
316
"-Load Default- " ,
318
317
"-Save and Reboot- " ,
319
318
"-Exit no Save- " };
@@ -491,7 +490,7 @@ void get_thermocouple_temperature(){
491
490
sensor_values .thermocouple_temperature = TC_temp * TC_temp * TC_COMPENSATION_X2_NT115 + TC_temp * TC_COMPENSATION_X1_NT115 + TC_COMPENSATION_X0_NT115 ;
492
491
}
493
492
494
- /*Adjust measured temperature to fit calibrated values */
493
+ /* Adjust measured temperature to fit calibrated values */
495
494
if (sensor_values .thermocouple_temperature < 100 ){
496
495
sensor_values .thermocouple_temperature = sensor_values .thermocouple_temperature * (flash_values .temp_cal_100 )/100 ;
497
496
}
@@ -1594,24 +1593,24 @@ int main(void)
1594
1593
#endif
1595
1594
1596
1595
/* Send debug information */
1597
- #ifdef DEBUG
1598
- if (HAL_GetTick () - previous_millis_debug >= interval_debug ){
1599
- UART_packet_length = 9 * sizeof (float );
1600
- pack_frame_start (UART_transmit_buffer , & UART_packet_index , UART_packet_length );
1601
- pack_float (UART_transmit_buffer , & UART_packet_index , (float )sensor_values .thermocouple_temperature );
1602
- pack_float (UART_transmit_buffer , & UART_packet_index , (float )sensor_values .thermocouple_temperature_filtered );
1603
- pack_float (UART_transmit_buffer , & UART_packet_index , (float )PID_setpoint );
1604
- pack_float (UART_transmit_buffer , & UART_packet_index , (float )sensor_values .requested_power /PID_MAX_OUTPUT * 100.0 );
1605
- pack_float (UART_transmit_buffer , & UART_packet_index , (float )sensor_values .requested_power_filtered /PID_MAX_OUTPUT * 100.0 );
1606
- pack_float (UART_transmit_buffer , & UART_packet_index , (float )PID_GetPpart (& TPID )/10.0 );
1607
- pack_float (UART_transmit_buffer , & UART_packet_index , (float )PID_GetIpart (& TPID )/10.0 );
1608
- pack_float (UART_transmit_buffer , & UART_packet_index , (float )PID_GetDpart (& TPID )/10.0 );
1609
- pack_float (UART_transmit_buffer , & UART_packet_index , (float )sensor_values .heater_current );
1610
-
1611
- HAL_UART_Transmit_DMA (& huart1 ,(uint8_t * )UART_transmit_buffer , UART_packet_length + 2 ); // Add two for starting bit and packet length
1612
- previous_millis_debug = HAL_GetTick ();
1596
+ if (flash_values .serial_debug_print == 1 ){
1597
+ if (HAL_GetTick () - previous_millis_debug >= interval_debug ){
1598
+ UART_packet_length = 9 * sizeof (float );
1599
+ pack_frame_start (UART_transmit_buffer , & UART_packet_index , UART_packet_length );
1600
+ pack_float (UART_transmit_buffer , & UART_packet_index , (float )sensor_values .thermocouple_temperature );
1601
+ pack_float (UART_transmit_buffer , & UART_packet_index , (float )sensor_values .thermocouple_temperature_filtered );
1602
+ pack_float (UART_transmit_buffer , & UART_packet_index , (float )PID_setpoint );
1603
+ pack_float (UART_transmit_buffer , & UART_packet_index , (float )sensor_values .requested_power /PID_MAX_OUTPUT * 100.0 );
1604
+ pack_float (UART_transmit_buffer , & UART_packet_index , (float )sensor_values .requested_power_filtered /PID_MAX_OUTPUT * 100.0 );
1605
+ pack_float (UART_transmit_buffer , & UART_packet_index , (float )PID_GetPpart (& TPID )/10.0 );
1606
+ pack_float (UART_transmit_buffer , & UART_packet_index , (float )PID_GetIpart (& TPID )/10.0 );
1607
+ pack_float (UART_transmit_buffer , & UART_packet_index , (float )PID_GetDpart (& TPID )/10.0 );
1608
+ pack_float (UART_transmit_buffer , & UART_packet_index , (float )sensor_values .heater_current );
1609
+
1610
+ HAL_UART_Transmit_DMA (& huart1 ,(uint8_t * )UART_transmit_buffer , UART_packet_length + 2 ); // Add two for starting bit and packet length
1611
+ previous_millis_debug = HAL_GetTick ();
1612
+ }
1613
1613
}
1614
- #endif
1615
1614
1616
1615
/* Detect if a tip is present by sending a short voltage pulse and sense current */
1617
1616
if (flash_values .current_measurement == 1 ){
0 commit comments