diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a8f8e24..328c7cb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: totp on: push: - branches: [ master ] + branches: [ '**' ] pull_request: branches: [ master ] diff --git a/CMakeLists.txt b/CMakeLists.txt index 21eef57..67b7255 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,12 @@ add_executable(klib_project ${SOURCES} ${HEADERS} ) +# enable LTO +target_compile_options(klib PUBLIC "-flto") +target_compile_options(klib PUBLIC "-fuse-linker-plugin") +target_link_options(klib PUBLIC "-flto") +target_link_options(klib PUBLIC "-fuse-linker-plugin") + # set the output filename set_target_properties(klib_project PROPERTIES OUTPUT_NAME "klib" SUFFIX ".elf") diff --git a/ui/totp.hpp b/ui/totp.hpp index 6218afb..03340f6 100644 --- a/ui/totp.hpp +++ b/ui/totp.hpp @@ -182,16 +182,23 @@ namespace menu { totp_changed = true; } - // check if we should update the hashes - if ((Rtc::get() != last_epoch) || (last_interval != entries[current].interval)) { - // store the new epoch value - last_epoch = Rtc::get(); - - // get the runtime for the timing circle - last_epoch_runtime = klib::io::systick<>::get_runtime(); + // get the rtc time + const auto time = Rtc::get(); - // update the epoch buffer - klib::string::itoa(last_epoch.value, epoch_buf); + // check if we should update the hashes + if ((time != last_epoch) || (last_interval != entries[current].interval)) { + // only update the last epoch and runtime when the + // time has changed + if (time != last_epoch) { + // store the new epoch value + last_epoch = time; + + // get the runtime for the timing circle + last_epoch_runtime = klib::io::systick<>::get_runtime(); + + // update the epoch buffer + klib::string::itoa(last_epoch.value, epoch_buf); + } // update the seconds left in this cycle klib::string::itoa(