Heater for threaded program

Dependents:   LEX_Threaded_Programming

Revision:
4:29ffcc7b410e
Parent:
3:313711a66929
Child:
5:21442d9d19c5
Child:
6:71d9c10fca4a
--- a/Heater.cpp	Wed Jul 17 20:46:20 2019 +0000
+++ b/Heater.cpp	Thu Jul 18 12:17:42 2019 +0000
@@ -27,24 +27,22 @@
 void Heater::read()
 {
     //Reads R and then resets the drive back to its previous value
+   
     int i = 0;
     int drive_prev = drive;     //Store previous value of drive
     drive = 1;
-    wait_us(MEAS_DELAY);        //Wait for ADC to settle
+    wait_us(50);        //Wait for ADC to settle
     adc.start_conversion(ALL_CH);
     while(adc_busy == 1)
         {
             wait_us(1);
             i++;
         }
+    drive = drive_prev;
     adc.read_channels();
-        
-    drive = drive_prev;
-
             
     //pc.printf("conversion took %d us\n", i );
-    i=0;
-    
+    //i=0;
     
     curr = adc.read_channel_result(i_port);
     v = adc.read_channel_result(v_port);
@@ -94,7 +92,10 @@
     }
 }
     
-
+void Heater::ramp_T(int ramp_time, float T_final, float T_start) 
+{
+    ramp_R(ramp_time, T_to_R(T_final), T_to_R(T_start));
+}
 void Heater::Set_R_ref(float R) {R_ref = R;}
 void Heater::Set_T_ref(float T_ref) {R_ref = T_to_R(T_ref);}