31 #include "reflow_oven.h"
40 const PROFILE profiles[NUM_PROFILES] = {
41 {100,100,150,100,230,90,20,90,60, 183},
42 {150,100,200,100,250,90,30,90,60, 217}
48 void doCommit(UFDATA* p_ufdata) {
50 u_memaddr.u32 = DATA_FLASH_PAGE;
54 void doRead(UFDATA* p_ufdata) {
56 u_memaddr.u32 = DATA_FLASH_PAGE;
60 char *getProfileDesc(
uint8_t u8_p) {
61 if (u8_p == LEADTIN)
return(
"Lead(40%)/Tin (60%) mix");
62 else return(
"Lead-free");
66 void printProfile (
uint8_t u8_p) {
70 printf(
"%s profile, Wet temp: %d C \n",
72 profiles[u8_p].i16_wetTemp);
73 else printf(
"%s profile, Wet temp: %d C \n",
75 profiles[u8_p].i16_wetTemp);
76 f_ramp = (float) (profiles[u8_p].i16_preheatTemp - 25.0)/(float)profiles[u8_p].u16_preheatTime;
77 printf(
"Preheat Temp: %d C, Time: %d s, Ramp: %6.2f (C/s)\n",
78 profiles[u8_p].i16_preheatTemp,
79 profiles[u8_p].u16_preheatTime,
81 f_ramp = (profiles[u8_p].i16_soakTemp - profiles[u8_p].i16_preheatTemp)/(
float)profiles[u8_p].u16_soakTime;
82 printf(
"Soak Temp: %d C, Time: %d s, Ramp: %6.2f (C/s)\n",
83 profiles[u8_p].i16_soakTemp,
84 profiles[u8_p].u16_soakTime,
86 f_ramp = (float)(profiles[u8_p].i16_reflowTemp - profiles[u8_p].i16_soakTemp)/(float)profiles[u8_p].u16_reflowTime;
87 printf(
"Reflow Temp: %d C, Time: %d s, Ramp: %6.2f (C/s), Hold time: %d\n",
88 profiles[u8_p].i16_reflowTemp,
89 profiles[u8_p].u16_reflowTime,
91 profiles[u8_p].u16_reflowHoldTime);
93 f_ramp = (float)(profiles[u8_p].i16_reflowTemp - profiles[u8_p].i16_coolTemp)/(float)profiles[u8_p].u16_coolTime;
94 printf(
"Cool1 Temp: %d C, Time: %d s, Ramp: %6.2f (C/s)\n",
95 profiles[u8_p].i16_coolTemp,
96 profiles[u8_p].u16_coolTime,
102 #define SETTLE_TIME 15 //seconds
104 static inline void DELAY_SECONDS(
uint8_t u8_s) {
111 void doTempCal(
void) {
115 u8_currPowerSetting = 0;
116 printf(
"Warning: Oven must be at room temperature and door closed to do calibration.\n");
117 printf(
"Warning: This takes 30 minutes! Do you still want to continue? (y/n): ");
119 if (u8_c !=
'y')
return;
120 tempC = getCelsiusI16Temp();
121 if ((tempC < 20) || (tempC > 40)) {
122 printf(
"\nTemperature is %u; it is not between 20C and 40C, something is wrong, aborting...\n",
126 fdata.caldata.temp[0] = tempC;
127 printf(
"\nRoom temperature is: %uC\n", tempC);
128 printf(
"Beginning calibration...hit any key to exit.\n");
129 for (u8_i = 1; u8_i <= 100; u8_i++) {
130 u8_currPowerSetting++;
131 DELAY_SECONDS(SETTLE_TIME);
132 tempC = getCelsiusI16Temp();
133 fdata.caldata.temp[u8_i] = tempC;
134 printf(
"Power: %u, Temp: %u \n",u8_i, tempC);
136 if (tempC > MAX_TEMP)
break;
138 u8_currPowerSetting = 0;
140 while (u8_i <= 100) {
141 fdata.caldata.temp[u8_i] = tempC;
145 printf(
"Calibration data written.\n");
148 void printTempCal(
void) {
150 printf(
"\nPower Setting Temp (C)\n");
151 for (u8_i=0; u8_i <= 100; u8_i++) {
153 u8_i, fdata.caldata.temp[u8_i]);
157 uint8_t printProfileMenu(
void) {
158 printf(
"\n1 Print Tin/Lead mix profile\n");
159 printf(
"2 Print Lead-free profile\n");
160 printf(
"3 Print temperature calibration data\n");
161 printf(
"4 Perform temperature calibration and commit to flash\n");
162 printf(
"5 Toggle Profile\n");
164 printf(
" Enter number (1-6): ");
169 void doProfileMenu(
void) {
173 u8_c = printProfileMenu();
189 u8_currentProfile =!u8_currentProfile;
190 printf(
"Current profile: %s\n", getProfileDesc(u8_currentProfile));
193 }
while (u8_c !=
'6');