Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A improved version of the dolphin-counter for Flipper zero byhttps://github.com/Krulknul/dolphin-counter

NotificationsYou must be signed in to change notification settings

TEXploder/TEX-Counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

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.

Tutorial

1. Beginners

Simply drop the.fap file into theapps directory on your Flipper Zero SD card using qFlipper or manually.

2. Professionals

If you're experienced, you know what to do with the counter folder. Just drop it insideuser_applications and compile it withfbt orufbt.

Code Explanation

Includes and Definitions

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.

Struct Definition

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.

Save and Load Counter Value

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.

State Management

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.

Input and Rendering Callbacks

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.

Initialization and Main Loop

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.

Credits

About

A improved version of the dolphin-counter for Flipper zero byhttps://github.com/Krulknul/dolphin-counter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp