- sprintf(tmpstr, "L%lld\n", devc->limit_samples);
- if (send_serial_w_ack(serial, tmpstr) != SR_OK) {
- sr_err("Sample limit to device failed");
+ //To support future devices that may allow the analog scale/offset to change, call get_dev_cfg again to get new values
+ if(raspberrypi_pico_get_dev_cfg(sdi) != SR_OK){
+ sr_err("get_dev_cfg failure on start");
+ return SR_ERR;
+ }
+
+ //With all other params set, we use the final sample rate setting as an opportunity for the device
+ //to communicate any errors in configuration.
+ //A single "*" indicates success.
+ //A "*" with subsequent data is success, but allows for the device to print something
+ //to the error console without aborting.
+ //A non "*" in the first character blocks the start
+ sprintf(tmpstr, "R%llu\n", devc->sample_rate);
+ num_read = send_serial_w_resp(serial, tmpstr, buf, 30);
+ buf[num_read]=0;
+ if((num_read>1)&&(buf[0]=='*')){
+ sr_err("Sample rate to device success with resp %s",buf);
+ }
+ else if(!((num_read==1)&&(buf[0]=='*'))){
+ sr_err("Sample rate to device failed");
+ if(num_read>0){
+ buf[num_read]=0;
+ sr_err("sample_rate error string %s",buf);
+ }