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

Commit

Permalink
Merge branch 'mlp6/publish_exhaust_temp' of github.com:mlp6/ADPL into…
Browse files Browse the repository at this point in the history
… mlp6/publish_exhaust_temp
  • Loading branch information
mlp6 committed May 9, 2018
2 parents b35025e + 27cf9a5 commit 80597a2
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 80597a2

Please sign in to comment.