mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-14 09:25:30 -04:00
Formatted code (#1007)
* Updated style * Updated files * fixed new line * Updated spacing * File fix WIP * Updated to clang 13 * updated comment style * Removed old comment code
This commit is contained in:
parent
7aca7ce74d
commit
033c4e9a5b
599 changed files with 70746 additions and 66896 deletions
|
@ -34,29 +34,25 @@ namespace ui {
|
|||
/* BasebandStatsView *****************************************************/
|
||||
|
||||
BasebandStatsView::BasebandStatsView() {
|
||||
add_children({
|
||||
&text_stats,
|
||||
});
|
||||
add_children({
|
||||
&text_stats,
|
||||
});
|
||||
}
|
||||
|
||||
static std::string ticks_to_percent_string(const uint32_t ticks) {
|
||||
constexpr size_t decimal_digits = 1;
|
||||
constexpr size_t decimal_factor = decimal_digits * 10;
|
||||
constexpr size_t decimal_digits = 1;
|
||||
constexpr size_t decimal_factor = decimal_digits * 10;
|
||||
|
||||
const uint32_t percent_x10 = ticks / (base_m4_clk_f / (100 * decimal_factor));
|
||||
const uint32_t percent_x10_clipped = std::min(percent_x10, static_cast<uint32_t>(100 * decimal_factor) - 1);
|
||||
return
|
||||
to_string_dec_uint(percent_x10_clipped / decimal_factor, 2) + "." +
|
||||
to_string_dec_uint(percent_x10_clipped % decimal_factor, decimal_digits, '0');
|
||||
const uint32_t percent_x10 = ticks / (base_m4_clk_f / (100 * decimal_factor));
|
||||
const uint32_t percent_x10_clipped = std::min(percent_x10, static_cast<uint32_t>(100 * decimal_factor) - 1);
|
||||
return to_string_dec_uint(percent_x10_clipped / decimal_factor, 2) + "." +
|
||||
to_string_dec_uint(percent_x10_clipped % decimal_factor, decimal_digits, '0');
|
||||
}
|
||||
|
||||
void BasebandStatsView::on_statistics_update(const BasebandStatistics& statistics) {
|
||||
std::string message = ticks_to_percent_string(statistics.idle_ticks)
|
||||
+ " " + ticks_to_percent_string(statistics.main_ticks)
|
||||
+ " " + ticks_to_percent_string(statistics.rssi_ticks)
|
||||
+ " " + ticks_to_percent_string(statistics.baseband_ticks);
|
||||
std::string message = ticks_to_percent_string(statistics.idle_ticks) + " " + ticks_to_percent_string(statistics.main_ticks) + " " + ticks_to_percent_string(statistics.rssi_ticks) + " " + ticks_to_percent_string(statistics.baseband_ticks);
|
||||
|
||||
text_stats.set(message);
|
||||
text_stats.set(message);
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue