- Notifications
You must be signed in to change notification settings - Fork0
A improved version of the dolphin-counter for Flipper zero byhttps://github.com/Krulknul/dolphin-counter
TEXploder/TEX-Counter
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This project enhances the Dolphin-Counter originally developed byKrulknul. The new version now saves the counter value and can read it again after restarting the Flipper Zero.
Simply drop the.fap file into theapps directory on your Flipper Zero SD card using qFlipper or manually.
If you're experienced, you know what to do with the counter folder. Just drop it insideuser_applications and compile it withfbt orufbt.
The code begins by including necessary libraries likefuri.h,gui/gui.h,input/input.h, and others. These libraries provide essential functions for handling input, graphics, notifications, and storage. Several constants are defined, such asMAX_COUNT,NUM_WIDTH, and file paths, which are used throughout the program to control the behavior of the counter.
TheCounter struct is defined to hold the state of the counter application. It includes fields likeinput_queue,view_port,gui,mutex, andnotifications to manage different aspects of the application. Additionally, it stores the currentcount, apressed state, aboxtimer, and avibro flag to manage the vibration feature.
The functionssave_counter_value() andload_counter_value() are implemented to persist the counter value to a file on the device's storage. This allows the counter to remember its state across restarts. Thesave_counter_value() function opens the file in write mode and saves the current count. Conversely,load_counter_value() reads the saved value from the file when the application starts.
Thestate_free() function is responsible for cleaning up the application's resources when it exits. It removes the view port from the GUI, closes the mutex, and frees the memory allocated for theCounter struct.
Theinput_callback() function handles user input. It checks for short and long presses and enqueues them for processing. Therender_callback() function is responsible for drawing the counter on the screen. It displays the counter value and updates the graphics based on the user's interaction.
Thestate_init() function initializes theCounter struct and sets up the input and rendering callbacks. It also loads the saved counter value, ensuring that the counter starts with the correct number after a restart.
Thetexcounterapp() function is the main loop of the application. It continuously processes user input and updates the counter value accordingly. It also manages the vibration feature, allowing the user to toggle it on and off. When the user exits the application, the state is cleaned up usingstate_free().
This enhanced Dolphin-Counter allows users to increment or decrement the counter, save the current value, and continue from where they left off after restarting their Flipper Zero.
- Original Dolphin-Counter byKrulknul:Dolphin Counter Repository
- fbt for building the Flipper Zero applications.
- ufbt for an alternative Flipper Zero build tool.
About
A improved version of the dolphin-counter for Flipper zero byhttps://github.com/Krulknul/dolphin-counter
Resources
Uh oh!
There was an error while loading.Please reload this page.