]> jspc29.x-matter.uni-frankfurt.de Git - avr.git/commitdiff
set-points adjusted
authorMichael Wiebusch <m.wiebusch@gsi.de>
Thu, 1 Dec 2016 14:11:38 +0000 (15:11 +0100)
committerMichael Wiebusch <m.wiebusch@gsi.de>
Thu, 1 Dec 2016 14:11:38 +0000 (15:11 +0100)
atmega32u4/cooler/cooler.c

index 01ad0707f12985e9d4b6863dae959640aa2f59de..02a2c7a7ef022c78df7095d33f7102d061ca4d78 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "main.h"
 
-#define SET_VAL_UPPER  30*16 //upper limit to set value
+#define SET_VAL_UPPER  50*16 //upper limit to set value
 #define SET_VAL_LOWER -20*16 //lower limit to set value
 
 #define MAX(x,y)               (((x) > (y)) ? (x) : (y))
@@ -370,7 +370,7 @@ void new_set_value(int16_t value){
 #define PID_INTEGRAL_LIMIT     600
 #define PID_FINE_INTERVAL      2*16 // within 2 degrees
 
-uint16_t pid_calculation(int16_t error) {
+int16_t pid_calculation(int16_t error) {
   static int16_t intg_error   = 0;
   static int16_t last_error   = 0;
   int16_t        diff_error   = error-last_error;
@@ -388,7 +388,7 @@ uint16_t pid_calculation(int16_t error) {
     + (( ((int32_t) diff_error) * PID_CONST_DIFF)/10)
     + (( ((int32_t) error     ) * PID_CONST_PROP)/10);
   // allow only positive values;
-  actuator = MAX(0,actuator);
+//   actuator = MAX(0,actuator); 
   // output is limited
   actuator = MIN(PID_ACTOR_OUTPUT_LIMIT,actuator);
   last_error = error;
@@ -512,7 +512,7 @@ __attribute__((naked)) int main(void) {
       pushvalue(1,temps[SUPPSENSOR]);
       lastsecond = second;
       
-      if(temps[MAINSENSOR] > 40*16){ // turn off peltier if temperature is off limits (>30 deg C)
+      if(temps[MAINSENSOR] > SET_VAL_UPPER*16){ // turn off peltier if temperature is off limits (>30 deg C)
 //         set_PWM_output_A(0);
 //         set_PWM_output_B(0);
         set_peltier_output(0);