Skip to content

Commit

Permalink
proxy: Use const char * variant of ConfObject::get()
Browse files Browse the repository at this point in the history
Gets rid of the unnecessary String objects.
  • Loading branch information
MattiasTF committed Oct 17, 2024
1 parent 076fd08 commit 635a4b3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions software/src/modules/proxy/proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,22 @@ void Proxy::register_urls()
api.addState("proxy/devices", &devices);
api.addPersistentConfig("proxy/config", &config, {"authentication_secret"});

task_scheduler.scheduleWithFixedDelay([this](){
task_scheduler.scheduleWithFixedDelay([this]() {
char char_str[2];
char_str[1] = 0;

for(char c = 'A'; c <= 'F'; ++c) {
uint32_t spitfp_checksum, spitfp_frame, tfp_frame, tfp_unexpected;

tf_hal_get_error_counters(&hal, c, &spitfp_checksum, &spitfp_frame, &tfp_frame, &tfp_unexpected);

error_counters.get(String(c))->get("SpiTfpChecksum")->updateUint(spitfp_checksum);
error_counters.get(String(c))->get("SpiTfpFrame")->updateUint(spitfp_frame);
error_counters.get(String(c))->get("TfpFrame")->updateUint(tfp_frame);
error_counters.get(String(c))->get("TfpUnexpected")->updateUint(tfp_unexpected);
char_str[0] = c;
Config *port_error_counters = static_cast<Config *>(error_counters.get(char_str, 1));

port_error_counters->get("SpiTfpChecksum")->updateUint(spitfp_checksum);
port_error_counters->get("SpiTfpFrame" )->updateUint(spitfp_frame);
port_error_counters->get("TfpFrame" )->updateUint(tfp_frame);
port_error_counters->get("TfpUnexpected" )->updateUint(tfp_unexpected);
}
}, 5_s, 5_s);
}

0 comments on commit 635a4b3

Please sign in to comment.