diff --git a/src/experiment.c b/src/experiment.c index ab6bc8bdadd7501e5d9bdc7179b40c634eb911cc..e565b3688ae79eb5f0fe3f18045a7e72db4c3240 100644 --- a/src/experiment.c +++ b/src/experiment.c @@ -135,16 +135,33 @@ void experiment_handler(char command[]){ //request additional parameters from computer printf("@RQP %u\n", 2*(uint16_t)p5); - uint8_t i; + uint16_t i; + uint8_t result; for (i=0; i<p5; i++){ - scanf("%u", &step_dac[i]); // get voltage steps (dac units) - printf("#INFO: DAC: %u\n", step_dac[i]); + while (1) { + result = scanf("%u", &step_dac[i]); // get voltage steps (dac units) + if (result == 1) { + printf("@RCVC %u\n", step_dac[i]); + break; + } + else { + printf("@RCVE\n"); + } + } } for (i=0; i<p5; i++){ - scanf("%u", &step_seconds[i]); //get step durations (seconds) - printf("#INFO: Time: %u\n", step_seconds[i]); + while (1) { + result = scanf("%u", &step_seconds[i]); // get time steps (seconds) + if (result == 1) { + printf("@RCVC %u\n", step_seconds[i]); + break; + } + else { + printf("@RCVE\n"); + } + } } printf("@RCP %u\n", 2*(uint16_t)p5); @@ -1255,4 +1272,4 @@ ISR(PORTD_INT0_vect){ if (portd_int0_callback) { portd_int0_callback(); } -} \ No newline at end of file +}