Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
rm no_bucket data string option (closes #290)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlp6 committed May 8, 2018
1 parent ef885aa commit 27cf9a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
6 changes: 2 additions & 4 deletions software/ADPL_electron/PublishDataCell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
7 changes: 3 additions & 4 deletions software/ADPL_electron/PublishDataSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 27cf9a5

Please sign in to comment.