diff --git a/DSTAT-temp/src/main.c b/DSTAT-temp/src/main.c index fda7f6b53373ffcc718a174f6accb8bd6fb9fb87..e82cba2ab9ba6c13e8120c4062f9728108bf63a6 100644 --- a/DSTAT-temp/src/main.c +++ b/DSTAT-temp/src/main.c @@ -24,6 +24,10 @@ int8_t command_handler(char command){ * Calls functions in * @param command Command character input. */ + + int16_t pcv1, pcv2; + uint16_t pct1, pct2; + switch (command){ case 'A': //ADS Buffer/rate/PGA values from ads1255.h scanf("%x%x%x",&o1,&o2,&o3); @@ -39,17 +43,20 @@ int8_t command_handler(char command){ break; case 'L': //LSV - start, stop, slope - scanf("%i%i%u",&p1,&p2,&u1); + scanf("%u%u%i%i%i%i%u",&pct1,&pct2,&pcv1,&pcv2,&p1,&p2,&u1); + precond(pcv1,pct1,pcv2,pct2); lsv_experiment(p1,p2,u1,2); break; case 'C': //CV - v1, v2, start, scans, slope - scanf("%i%i%i%u%u",&p1,&p2,&p3,&p5,&u1); + scanf("%u%u%i%i%i%i%i%u%u",&pct1,&pct2,&pcv1,&pcv2,&p1,&p2,&p3,&p5,&u1); + precond(pcv1,pct1,pcv2,pct2); cv_experiment(p1,p2,p3,p5,u1); break; case 'S': //SWV - start, stop, step size, pulse_height, frequency, scans - scanf("%i%i%u%u%u%u",&p1,&p2,&u1,&u2,&u3,&u4); + scanf("%u%u%i%i%i%i%u%u%u%u",&pct1,&pct2,&pcv1,&pcv2,&p1,&p2,&u1,&u2,&u3,&u4); + precond(pcv1,pct1,pcv2,pct2); swv_experiment(p1,p2,u1,u2,u3,u4); break; @@ -60,6 +67,7 @@ int8_t command_handler(char command){ //allocate arrays for steps uint16_t * step_dac = malloc(p5*sizeof(uint16_t)); uint16_t * step_seconds = malloc(p5*sizeof(uint16_t)); + //check for successful allocation if (!step_dac || !step_seconds){ printf("#ERR: Could not allocate memory\n\r"); @@ -77,7 +85,7 @@ int8_t command_handler(char command){ scanf("%u", &step_seconds[i]); //get step durations (seconds) printf("#Time: %u\n\r", step_seconds[i]); } - + ca_experiment(p5, step_dac, step_seconds); //free arrays diff --git a/DSTAT1.atsuo b/DSTAT1.atsuo index eaee2bba9f0de3e79c1fe0fae1ffe578ee751b0f..e9285442c605f94fecea94ef2226a0542702f29e 100644 Binary files a/DSTAT1.atsuo and b/DSTAT1.atsuo differ