From 27cf9a5efa1d5287aad3f4240d1babe738d736f1 Mon Sep 17 00:00:00 2001 From: Mark Palmeri Date: Tue, 8 May 2018 11:39:13 -0400 Subject: [PATCH] rm no_bucket data string option (closes #290) --- software/ADPL_electron/PublishDataCell.cpp | 6 ++---- software/ADPL_electron/PublishDataSD.cpp | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/software/ADPL_electron/PublishDataCell.cpp b/software/ADPL_electron/PublishDataCell.cpp index 5cd20f9..11b8a49 100644 --- a/software/ADPL_electron/PublishDataCell.cpp +++ b/software/ADPL_electron/PublishDataCell.cpp @@ -6,12 +6,10 @@ bool PublishDataCell::publish(double HXCI, double HXCO, double HTR, int gasOn, int bucket_tip_count){ char data_str [69]; - // bucket.tip_count will be ignored if not needed by sprintf fmt_string = "HXCI:%.1f,HXCO:%.1f,HTR:%.1f,HXHI:%.1f,HXHO:%.1f,E:%.1f,V:%d,B:%d"; - fmt_string_no_bucket = "HXCI:%.1f,HXCO:%.1f,HTR:%.1f,HXHI:%.1f,HXHO:%.1f,E:%.1f,V:%d"; - sprintf(data_str, (bucket_tip_count > 0) ? fmt_string : fmt_string_no_bucket, - HXCI, HXCO, HTR, HXHI, HXHO, Exhaust, gasOn, bucket_tip_count); + sprintf(data_str, fmt_string, HXCI, HXCO, HTR, HXHI, HXHO, Exhaust, + gasOn, bucket_tip_count); return Particle.publish("DATA", data_str); } diff --git a/software/ADPL_electron/PublishDataSD.cpp b/software/ADPL_electron/PublishDataSD.cpp index f281966..68e8153 100644 --- a/software/ADPL_electron/PublishDataSD.cpp +++ b/software/ADPL_electron/PublishDataSD.cpp @@ -6,12 +6,11 @@ bool PublishDataSD::publish(double HXCI, double HXCO, double HTR, double HXHI, d double Exhaust, int gasOn, int bucket_tip_count, File sdFile){ char data_str [79]; int bitsWritten = -1; - // bucket.tip_count will be ignored if not needed by sprintf + fmt_string_SD = "[%d]HXCI:%.1f,HXCO:%.1f,HTR:%.1f,HXHI:%.1f,HXHO:%.1f,E:%.1f,V:%d,B:%d"; - fmt_string_no_bucket_SD = "[%d]HXCI:%.1f,HXCO:%.1f,HTR:%.1f,HXHI:%.1f,HXHO:%.1f,E:%.1f,V:%d"; - sprintf(data_str, (bucket_tip_count > 0) ? fmt_string_SD : fmt_string_no_bucket_SD, - Time.now(), HXCI, HXCO, HTR, HXHI, HXHO, Exhaust, gasOn, bucket_tip_count); + sprintf(data_str, fmt_string_SD, Time.now(), HXCI, HXCO, HTR, HXHI, HXHO, + Exhaust, gasOn, bucket_tip_count); // open the file for write at end like the "Native SD library" sdFile.open("adpl_data.txt", O_RDWR | O_CREAT | O_AT_END);