Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lto #4

Merged
merged 3 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: totp

on:
push:
branches: [ master ]
branches: [ '**' ]
pull_request:
branches: [ master ]

Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
25 changes: 16 additions & 9 deletions ui/totp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading