Skip to content
Snippets Groups Projects
Commit 3dbb76df authored by Michael DM Dryden's avatar Michael DM Dryden
Browse files

Finished preconditioning interface. **Will break with older versions of dstat-interface**

parent 0822feea
Branches
Tags
No related merge requests found
......@@ -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
......
No preview for this file type
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment