![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
LEX_Threaded_Programming
Dependencies: Heater_V2 MODSERIAL Nanopb FastPWM ADS8568_ADC
main.cpp@9:9474da78cec3, 2019-09-12 (annotated)
- Committer:
- justinbuckland
- Date:
- Thu Sep 12 12:43:07 2019 +0000
- Revision:
- 9:9474da78cec3
- Parent:
- 8:58c6d51957df
- Child:
- 10:f8202e71e765
Update to trigger camera
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
omatthews | 0:54bedd3964e2 | 1 | #include "mbed.h" |
omatthews | 0:54bedd3964e2 | 2 | #include "pb.h" |
omatthews | 0:54bedd3964e2 | 3 | #include "pb_decode.h" |
omatthews | 0:54bedd3964e2 | 4 | #include "pb_encode.h" |
omatthews | 0:54bedd3964e2 | 5 | #include "MODSERIAL.h" |
omatthews | 0:54bedd3964e2 | 6 | #include "ADS8568_ADC.h" |
omatthews | 0:54bedd3964e2 | 7 | #include "Heater.h" |
omatthews | 0:54bedd3964e2 | 8 | #include "FastPWM.h" |
omatthews | 0:54bedd3964e2 | 9 | #include "memspcr.pb.h" |
omatthews | 0:54bedd3964e2 | 10 | #include <vector> |
omatthews | 0:54bedd3964e2 | 11 | #include <iterator> |
omatthews | 0:54bedd3964e2 | 12 | |
justinbuckland | 8:58c6d51957df | 13 | #define BUFFER_SIZE 4096 |
justinbuckland | 9:9474da78cec3 | 14 | #define LED_PULSE_PERIOD 8400 // ticks, 10kHz when CPU clock is 84MHz |
justinbuckland | 9:9474da78cec3 | 15 | #define LED_PULSE_WIDTH 4200 // ticks, 50% duty cycle |
justinbuckland | 8:58c6d51957df | 16 | |
omatthews | 0:54bedd3964e2 | 17 | Heater * heater; |
intrinseca | 4:63d7f2a0dec6 | 18 | float r_gradient; //setpoint setting |
omatthews | 5:702b32ead94e | 19 | |
omatthews | 0:54bedd3964e2 | 20 | |
justinbuckland | 8:58c6d51957df | 21 | MODSERIAL pc(PA_9, PA_10, BUFFER_SIZE); //mcu TX, RX, BUFFER_SIZE byte TX and RX buffers |
omatthews | 0:54bedd3964e2 | 22 | ADS8568_ADC adc(PB_15, PB_14, PB_13, PB_12, PC_15, PC_0, PC_1, PC_2, PC_3); |
omatthews | 0:54bedd3964e2 | 23 | I2C i2c(PB_7, PB_8); //SDA, SCL |
omatthews | 0:54bedd3964e2 | 24 | Timer timer; |
omatthews | 0:54bedd3964e2 | 25 | DigitalIn adc_busy(PA_8); //Busy interrupt sig# |
omatthews | 5:702b32ead94e | 26 | |
omatthews | 0:54bedd3964e2 | 27 | |
omatthews | 0:54bedd3964e2 | 28 | //Heater Control |
omatthews | 5:702b32ead94e | 29 | FastPWM drive_main(PC_9); |
omatthews | 5:702b32ead94e | 30 | FastPWM drive_lysis(PC_8); |
omatthews | 5:702b32ead94e | 31 | FastPWM guard_main(PC_7); |
omatthews | 5:702b32ead94e | 32 | FastPWM guard_lysis(PC_6); |
justinbuckland | 7:a4fc853feb30 | 33 | |
justinbuckland | 7:a4fc853feb30 | 34 | int heater_ID_main = 1; |
justinbuckland | 7:a4fc853feb30 | 35 | int heater_ID_lysis = 2; |
omatthews | 5:702b32ead94e | 36 | int i_port_main = 0; |
omatthews | 5:702b32ead94e | 37 | int i_port_lysis = 2; |
omatthews | 5:702b32ead94e | 38 | int v_port_main = 1; |
omatthews | 5:702b32ead94e | 39 | int v_port_lysis = 3; |
omatthews | 0:54bedd3964e2 | 40 | |
justinbuckland | 7:a4fc853feb30 | 41 | int heater_ID = 0; |
omatthews | 0:54bedd3964e2 | 42 | |
justinbuckland | 9:9474da78cec3 | 43 | //Illumination LED Control |
justinbuckland | 9:9474da78cec3 | 44 | |
omatthews | 0:54bedd3964e2 | 45 | |
justinbuckland | 7:a4fc853feb30 | 46 | //Indicator LEDs |
omatthews | 0:54bedd3964e2 | 47 | DigitalOut hb_led(PC_13); //Green |
omatthews | 0:54bedd3964e2 | 48 | DigitalOut led_0(PC_4); //Red |
omatthews | 0:54bedd3964e2 | 49 | DigitalOut led_1(PC_5); //Green |
omatthews | 0:54bedd3964e2 | 50 | |
justinbuckland | 7:a4fc853feb30 | 51 | //Camera and LED drive |
justinbuckland | 7:a4fc853feb30 | 52 | DigitalOut camTrigger(PB_2); //Trigger camera |
justinbuckland | 9:9474da78cec3 | 53 | FastPWM ledDrive(PB_4); //PWM drive LED for fluorescence detection |
justinbuckland | 7:a4fc853feb30 | 54 | |
omatthews | 0:54bedd3964e2 | 55 | //User buttons |
omatthews | 0:54bedd3964e2 | 56 | DigitalIn user_0(PB_0); |
omatthews | 0:54bedd3964e2 | 57 | DigitalIn user_1(PB_1); |
omatthews | 0:54bedd3964e2 | 58 | |
omatthews | 0:54bedd3964e2 | 59 | BusOut converts(PC_0, PC_1, PC_2, PC_3); |
omatthews | 0:54bedd3964e2 | 60 | |
omatthews | 0:54bedd3964e2 | 61 | //Threads |
omatthews | 6:ef2bcc5fe3af | 62 | Thread heater_control(osPriorityHigh); |
omatthews | 6:ef2bcc5fe3af | 63 | Thread logging_thread(osPriorityAboveNormal); |
omatthews | 0:54bedd3964e2 | 64 | |
omatthews | 0:54bedd3964e2 | 65 | //Tickers |
omatthews | 0:54bedd3964e2 | 66 | Ticker heat_tick; |
omatthews | 0:54bedd3964e2 | 67 | Ticker pressure_tick; |
omatthews | 0:54bedd3964e2 | 68 | Ticker log_tick; |
omatthews | 0:54bedd3964e2 | 69 | |
omatthews | 0:54bedd3964e2 | 70 | |
omatthews | 0:54bedd3964e2 | 71 | //Flags |
omatthews | 5:702b32ead94e | 72 | EventFlags flags; //Flags: |
omatthews | 5:702b32ead94e | 73 | // 0 => update heater |
omatthews | 5:702b32ead94e | 74 | // 1 => log state |
omatthews | 5:702b32ead94e | 75 | bool triggered_flag; |
omatthews | 0:54bedd3964e2 | 76 | bool status = true; |
omatthews | 0:54bedd3964e2 | 77 | |
omatthews | 0:54bedd3964e2 | 78 | //Configuration data |
omatthews | 0:54bedd3964e2 | 79 | memspcr_ExperimentConfiguration exp_config = memspcr_ExperimentConfiguration_init_zero; |
omatthews | 0:54bedd3964e2 | 80 | int buffer_length; |
omatthews | 0:54bedd3964e2 | 81 | size_t message_length; |
justinbuckland | 8:58c6d51957df | 82 | uint8_t buffer[BUFFER_SIZE]; |
omatthews | 0:54bedd3964e2 | 83 | |
omatthews | 0:54bedd3964e2 | 84 | |
omatthews | 0:54bedd3964e2 | 85 | //Functions for reading and decoding the message__________________________________________________ |
omatthews | 0:54bedd3964e2 | 86 | |
omatthews | 0:54bedd3964e2 | 87 | void read_message() |
omatthews | 0:54bedd3964e2 | 88 | { |
justinbuckland | 7:a4fc853feb30 | 89 | if (pc.scanf("%d",&message_length) < 0){pc.printf("# Error reading message length");} |
omatthews | 5:702b32ead94e | 90 | size_t buffer_length = sizeof(buffer); |
omatthews | 5:702b32ead94e | 91 | if (message_length > buffer_length) |
omatthews | 5:702b32ead94e | 92 | { |
justinbuckland | 7:a4fc853feb30 | 93 | pc.printf("# Message length exceeds buffer. \n Input configuration file\n"); |
omatthews | 5:702b32ead94e | 94 | read_message(); |
omatthews | 5:702b32ead94e | 95 | return; |
omatthews | 5:702b32ead94e | 96 | } |
justinbuckland | 7:a4fc853feb30 | 97 | pc.printf("# Message is %d chars long, buffer length is %d\n",message_length,buffer_length); |
omatthews | 5:702b32ead94e | 98 | unsigned int c; |
omatthews | 5:702b32ead94e | 99 | for (int i = 0; i < message_length; i++) |
omatthews | 0:54bedd3964e2 | 100 | { |
omatthews | 0:54bedd3964e2 | 101 | pc.scanf("%02X",&c); |
omatthews | 0:54bedd3964e2 | 102 | buffer[i] = (char) c; |
omatthews | 0:54bedd3964e2 | 103 | } |
omatthews | 0:54bedd3964e2 | 104 | } |
omatthews | 0:54bedd3964e2 | 105 | |
omatthews | 0:54bedd3964e2 | 106 | void decode_message() |
omatthews | 0:54bedd3964e2 | 107 | { |
omatthews | 5:702b32ead94e | 108 | // Create a stream that reads from the buffer. |
omatthews | 5:702b32ead94e | 109 | |
omatthews | 0:54bedd3964e2 | 110 | pb_istream_t istream = pb_istream_from_buffer(buffer, message_length); |
omatthews | 0:54bedd3964e2 | 111 | |
omatthews | 5:702b32ead94e | 112 | //Now we are ready to decode the message. |
omatthews | 0:54bedd3964e2 | 113 | status = pb_decode(&istream, memspcr_ExperimentConfiguration_fields, &exp_config); |
omatthews | 0:54bedd3964e2 | 114 | |
omatthews | 5:702b32ead94e | 115 | // Check for errors... |
omatthews | 5:702b32ead94e | 116 | if (!status) { |
justinbuckland | 7:a4fc853feb30 | 117 | pc.printf("# Decoding failed: %s\n", PB_GET_ERROR(&istream)); |
omatthews | 0:54bedd3964e2 | 118 | } |
omatthews | 0:54bedd3964e2 | 119 | } |
omatthews | 0:54bedd3964e2 | 120 | |
omatthews | 0:54bedd3964e2 | 121 | bool decode_callback(pb_istream_t *stream, const pb_field_t *field, void **arg) |
omatthews | 0:54bedd3964e2 | 122 | { |
omatthews | 0:54bedd3964e2 | 123 | vector <memspcr_ThermalStep> * dest = (vector <memspcr_ThermalStep> *)(*arg); |
omatthews | 0:54bedd3964e2 | 124 | memspcr_ThermalStep result = memspcr_ThermalStep_init_zero; |
omatthews | 0:54bedd3964e2 | 125 | status = pb_decode(stream, memspcr_ThermalStep_fields, & result); |
omatthews | 5:702b32ead94e | 126 | |
omatthews | 5:702b32ead94e | 127 | if (!status) { |
justinbuckland | 7:a4fc853feb30 | 128 | pc.printf("# Decode callback failed\n"); |
omatthews | 0:54bedd3964e2 | 129 | } |
omatthews | 0:54bedd3964e2 | 130 | |
intrinseca | 4:63d7f2a0dec6 | 131 | dest->push_back(result); //CHECK: Does result get copied into the vector? |
omatthews | 0:54bedd3964e2 | 132 | return true; |
omatthews | 0:54bedd3964e2 | 133 | } |
omatthews | 0:54bedd3964e2 | 134 | |
omatthews | 0:54bedd3964e2 | 135 | |
omatthews | 0:54bedd3964e2 | 136 | //Ticking functions_________________________________________________________________ |
omatthews | 0:54bedd3964e2 | 137 | |
omatthews | 6:ef2bcc5fe3af | 138 | |
omatthews | 5:702b32ead94e | 139 | void temp_trigger() |
omatthews | 0:54bedd3964e2 | 140 | { |
omatthews | 5:702b32ead94e | 141 | //This function triggers a temperature update. |
omatthews | 5:702b32ead94e | 142 | //N.B. update cannot be called directly from a ticker as tickers and |
omatthews | 0:54bedd3964e2 | 143 | //reading the ADC both rely on interrupts. |
omatthews | 5:702b32ead94e | 144 | flags.set(0x1); |
omatthews | 0:54bedd3964e2 | 145 | } |
omatthews | 0:54bedd3964e2 | 146 | |
omatthews | 6:ef2bcc5fe3af | 147 | |
omatthews | 6:ef2bcc5fe3af | 148 | |
omatthews | 2:b27d8f9a6e49 | 149 | void log_trigger() |
omatthews | 2:b27d8f9a6e49 | 150 | { |
omatthews | 5:702b32ead94e | 151 | flags.set(0x2); |
omatthews | 2:b27d8f9a6e49 | 152 | } |
justinbuckland | 7:a4fc853feb30 | 153 | |
omatthews | 5:702b32ead94e | 154 | void pressure_control() |
omatthews | 0:54bedd3964e2 | 155 | { |
omatthews | 0:54bedd3964e2 | 156 | //Input pressure control function here |
omatthews | 0:54bedd3964e2 | 157 | //i.e. |
omatthews | 0:54bedd3964e2 | 158 | //read_pressure(); |
omatthews | 0:54bedd3964e2 | 159 | //if (pressure < lower_bound) { |
omatthews | 5:702b32ead94e | 160 | //pump_turn_on(); |
omatthews | 5:702b32ead94e | 161 | //} |
omatthews | 0:54bedd3964e2 | 162 | //else if (pressure > upper_bound) { |
omatthews | 5:702b32ead94e | 163 | //pump_turn_off(); |
omatthews | 5:702b32ead94e | 164 | //} |
omatthews | 0:54bedd3964e2 | 165 | led_1 = !led_1; |
omatthews | 0:54bedd3964e2 | 166 | } |
omatthews | 0:54bedd3964e2 | 167 | |
omatthews | 2:b27d8f9a6e49 | 168 | |
omatthews | 0:54bedd3964e2 | 169 | |
omatthews | 0:54bedd3964e2 | 170 | |
omatthews | 5:702b32ead94e | 171 | //Other functions__________________________________________________________________ |
omatthews | 0:54bedd3964e2 | 172 | |
omatthews | 0:54bedd3964e2 | 173 | |
omatthews | 0:54bedd3964e2 | 174 | void temp_control() { |
omatthews | 0:54bedd3964e2 | 175 | while(1){ |
omatthews | 6:ef2bcc5fe3af | 176 | flags.wait_any(0x1,osWaitForever,true); |
omatthews | 0:54bedd3964e2 | 177 | heater->read(); |
omatthews | 0:54bedd3964e2 | 178 | heater->update(); |
omatthews | 0:54bedd3964e2 | 179 | } |
omatthews | 0:54bedd3964e2 | 180 | } |
omatthews | 5:702b32ead94e | 181 | |
omatthews | 2:b27d8f9a6e49 | 182 | void log_state() |
omatthews | 2:b27d8f9a6e49 | 183 | { |
omatthews | 2:b27d8f9a6e49 | 184 | while(1){ |
omatthews | 6:ef2bcc5fe3af | 185 | flags.wait_any(0x2,osWaitForever,true); |
omatthews | 6:ef2bcc5fe3af | 186 | //Output time, R_ref, R, error, error_integrated |
justinbuckland | 7:a4fc853feb30 | 187 | pc.printf("%10d,%10d,%10.6f,%10.6f\n", heater_ID, timer.read_ms(), heater->Get_R(), heater->Get_R_ref()); |
omatthews | 2:b27d8f9a6e49 | 188 | } |
omatthews | 2:b27d8f9a6e49 | 189 | } |
omatthews | 5:702b32ead94e | 190 | |
omatthews | 5:702b32ead94e | 191 | void set_point_routine(std::vector<memspcr_ThermalStep> profile) { |
omatthews | 5:702b32ead94e | 192 | int curr_time; |
omatthews | 5:702b32ead94e | 193 | vector <memspcr_ThermalStep>::iterator it_prev, it = profile.begin(); |
omatthews | 5:702b32ead94e | 194 | if (it->elapsed_time_ms != 0) |
omatthews | 5:702b32ead94e | 195 | { |
justinbuckland | 7:a4fc853feb30 | 196 | pc.printf("# Error: the first point in the profile should be at time 0.\n"); |
omatthews | 5:702b32ead94e | 197 | return; |
omatthews | 5:702b32ead94e | 198 | } |
omatthews | 2:b27d8f9a6e49 | 199 | it++; |
omatthews | 0:54bedd3964e2 | 200 | |
omatthews | 0:54bedd3964e2 | 201 | for (it_prev = profile.begin(); it < profile.end(); it ++, it_prev++){ |
omatthews | 0:54bedd3964e2 | 202 | triggered_flag = false; |
omatthews | 0:54bedd3964e2 | 203 | r_gradient = (it->resistance - it_prev->resistance)/(it->elapsed_time_ms - it_prev->elapsed_time_ms); |
omatthews | 0:54bedd3964e2 | 204 | while ((curr_time = timer.read_ms()) <= it->elapsed_time_ms){ |
omatthews | 5:702b32ead94e | 205 | heater->Set_ref(it_prev->resistance + r_gradient * (curr_time - it_prev->elapsed_time_ms)); |
justinbuckland | 8:58c6d51957df | 206 | |
justinbuckland | 9:9474da78cec3 | 207 | if (!triggered_flag && (it->camera_offset_ms != 0) && (curr_time > it_prev->elapsed_time_ms + it->camera_offset_ms)) |
omatthews | 0:54bedd3964e2 | 208 | { |
justinbuckland | 9:9474da78cec3 | 209 | //Start camera exposure and turn on LED if camera_offset_ms is non-zero |
justinbuckland | 7:a4fc853feb30 | 210 | camTrigger = 0; |
justinbuckland | 7:a4fc853feb30 | 211 | wait_us(10); |
justinbuckland | 7:a4fc853feb30 | 212 | camTrigger = 1; |
justinbuckland | 7:a4fc853feb30 | 213 | led_0 = 1; |
justinbuckland | 9:9474da78cec3 | 214 | ledDrive.pulsewidth_ticks(LED_PULSE_WIDTH); |
omatthews | 0:54bedd3964e2 | 215 | triggered_flag = true; |
omatthews | 0:54bedd3964e2 | 216 | } |
justinbuckland | 8:58c6d51957df | 217 | wait_us(200); |
omatthews | 0:54bedd3964e2 | 218 | } |
justinbuckland | 8:58c6d51957df | 219 | //Stop camera exposure and turn off LED at end of time segment |
justinbuckland | 8:58c6d51957df | 220 | camTrigger = 0; |
justinbuckland | 9:9474da78cec3 | 221 | ledDrive.pulsewidth_ticks(0); |
justinbuckland | 8:58c6d51957df | 222 | led_0 = 0; |
omatthews | 0:54bedd3964e2 | 223 | } |
omatthews | 0:54bedd3964e2 | 224 | } |
omatthews | 0:54bedd3964e2 | 225 | |
omatthews | 0:54bedd3964e2 | 226 | |
omatthews | 5:702b32ead94e | 227 | int main() |
omatthews | 5:702b32ead94e | 228 | { |
omatthews | 0:54bedd3964e2 | 229 | pc.baud(115200); |
omatthews | 0:54bedd3964e2 | 230 | adc.init(); |
omatthews | 5:702b32ead94e | 231 | |
omatthews | 0:54bedd3964e2 | 232 | buffer_length = sizeof(buffer)/sizeof(uint8_t); |
justinbuckland | 7:a4fc853feb30 | 233 | pc.printf("# Input configuration file\n"); |
omatthews | 5:702b32ead94e | 234 | |
justinbuckland | 9:9474da78cec3 | 235 | //set up LED PWM drive |
justinbuckland | 9:9474da78cec3 | 236 | ledDrive.prescaler(1); |
justinbuckland | 9:9474da78cec3 | 237 | ledDrive.period_ticks(LED_PULSE_PERIOD); |
justinbuckland | 9:9474da78cec3 | 238 | ledDrive.pulsewidth_ticks(0); |
justinbuckland | 9:9474da78cec3 | 239 | |
intrinseca | 4:63d7f2a0dec6 | 240 | //set up nanopb |
omatthews | 5:702b32ead94e | 241 | std::vector<memspcr_ThermalStep> profile; |
omatthews | 5:702b32ead94e | 242 | exp_config.profile.funcs.decode = decode_callback; |
omatthews | 5:702b32ead94e | 243 | exp_config.profile.arg = &profile; |
omatthews | 5:702b32ead94e | 244 | |
intrinseca | 4:63d7f2a0dec6 | 245 | //read and decode configuration |
intrinseca | 4:63d7f2a0dec6 | 246 | read_message(); |
justinbuckland | 7:a4fc853feb30 | 247 | pc.printf("# Message read\n"); |
omatthews | 0:54bedd3964e2 | 248 | decode_message(); |
justinbuckland | 7:a4fc853feb30 | 249 | pc.printf("# Message decoded\n"); |
omatthews | 5:702b32ead94e | 250 | |
omatthews | 6:ef2bcc5fe3af | 251 | Heater * heater_main = new Heater(i_port_main, v_port_main, & drive_main, & guard_main, & adc, adc_busy, exp_config.thermal); |
omatthews | 6:ef2bcc5fe3af | 252 | Heater * heater_lysis = new Heater(i_port_lysis, v_port_lysis, & drive_lysis, & guard_lysis, & adc, adc_busy, exp_config.thermal); |
omatthews | 5:702b32ead94e | 253 | |
omatthews | 5:702b32ead94e | 254 | //Select heater. Put control times in us for ticker functions |
omatthews | 5:702b32ead94e | 255 | if (exp_config.selected_heater == memspcr_ExperimentConfiguration_Heater_MAIN) { |
omatthews | 5:702b32ead94e | 256 | heater = heater_main; |
justinbuckland | 7:a4fc853feb30 | 257 | heater_ID = heater_ID_main; |
omatthews | 5:702b32ead94e | 258 | } else if (exp_config.selected_heater == memspcr_ExperimentConfiguration_Heater_LYSIS) { |
omatthews | 5:702b32ead94e | 259 | heater = heater_lysis; |
justinbuckland | 7:a4fc853feb30 | 260 | heater_ID = heater_ID_lysis; |
omatthews | 5:702b32ead94e | 261 | } else { |
justinbuckland | 8:58c6d51957df | 262 | pc.printf("# Error - no heater has been selected\n"); |
omatthews | 5:702b32ead94e | 263 | return 1; |
omatthews | 5:702b32ead94e | 264 | } |
omatthews | 5:702b32ead94e | 265 | |
justinbuckland | 7:a4fc853feb30 | 266 | pc.printf("# Starting pressure control\n"); |
omatthews | 0:54bedd3964e2 | 267 | pressure_tick.attach(& pressure_control, 1); |
justinbuckland | 7:a4fc853feb30 | 268 | pc.printf("# Waiting for start signal to begin temperature control (type in an s or press button 0)\n"); |
omatthews | 6:ef2bcc5fe3af | 269 | heater->Set_ref(0.0); |
omatthews | 6:ef2bcc5fe3af | 270 | heater_control.start(& temp_control); |
omatthews | 6:ef2bcc5fe3af | 271 | heat_tick.attach_us(& temp_trigger,exp_config.thermal.control_loop_interval_ms * 1000); |
omatthews | 6:ef2bcc5fe3af | 272 | |
omatthews | 2:b27d8f9a6e49 | 273 | while (pc.getcNb()!='s' && !user_0); |
omatthews | 5:702b32ead94e | 274 | |
justinbuckland | 8:58c6d51957df | 275 | pc.printf("# Start signal received\n"); |
omatthews | 0:54bedd3964e2 | 276 | |
omatthews | 2:b27d8f9a6e49 | 277 | logging_thread.start(& log_state); |
omatthews | 6:ef2bcc5fe3af | 278 | log_tick.attach_us(& log_trigger,exp_config.logging_interval_ms * 1000); |
omatthews | 0:54bedd3964e2 | 279 | |
justinbuckland | 7:a4fc853feb30 | 280 | pc.printf("# Starting routine\n"); |
justinbuckland | 7:a4fc853feb30 | 281 | pc.printf("# heater, time(ms), r, rSet\n"); |
omatthews | 2:b27d8f9a6e49 | 282 | timer.start(); |
omatthews | 5:702b32ead94e | 283 | set_point_routine(profile); |
omatthews | 6:ef2bcc5fe3af | 284 | |
omatthews | 6:ef2bcc5fe3af | 285 | //Turn off |
omatthews | 5:702b32ead94e | 286 | heat_tick.detach(); |
omatthews | 5:702b32ead94e | 287 | log_tick.detach(); |
omatthews | 5:702b32ead94e | 288 | wait(1); |
omatthews | 2:b27d8f9a6e49 | 289 | heater->turn_off(); |
justinbuckland | 8:58c6d51957df | 290 | |
justinbuckland | 8:58c6d51957df | 291 | |
justinbuckland | 7:a4fc853feb30 | 292 | pc.printf("# Finished\n"); |
justinbuckland | 7:a4fc853feb30 | 293 | |
omatthews | 5:702b32ead94e | 294 | return 0; |
omatthews | 5:702b32ead94e | 295 | } |