From 83ec0b6119082bdc2a3631228e83070ab1a26f4b Mon Sep 17 00:00:00 2001 From: Michael DM Dryden <mdryden@chem.utoronto.ca> Date: Tue, 4 Jul 2017 18:19:18 -0400 Subject: [PATCH] experiment: Fix CA parameter setting. --- src/experiment.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/experiment.c b/src/experiment.c index ab6bc8b..e565b36 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 +} -- GitLab