Skip to content

Commit 80af529

Browse files
committed
upd colorguess
1 parent 5597c36 commit 80af529

14 files changed

+89
-50
lines changed

apps_source_code/color_guess/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,7 @@ Then run the command:
2929
The application will be compiled and copied onto your device.
3030

3131
## Licensing
32-
This code is open-source and may be used for whatever you want to do with it.
32+
This code is open-source under the conditions of GNU GENERAL PUBLIC LICENSE.
33+
34+
## Credits
35+
Thanks to [Willy-JL](https://github.com/Willy-JL) for assisting in the fine-tuning of the app

apps_source_code/color_guess/application.fam

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ App(
99
],
1010
stack_size=2 * 1024,
1111
order=10,
12-
fap_icon="color_guess_10px.png",
12+
fap_icon="icons/color_guess_10px.png",
1313
fap_icon_assets="icons",
14-
fap_version="1.2",
14+
fap_version="1.5",
1515
fap_category="Games",
1616
fap_author="Leedave",
1717
fap_description="Color Guessing Game",
1818
fap_weburl="https://github.com/leedave/Leeds-Flipper-Zero-Applications",
19-
)
19+
)

apps_source_code/color_guess/color_guess.c

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ ColorGuess* color_guess_app_alloc() {
3434
// Load configs
3535
color_guess_read_settings(app);
3636

37-
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
38-
notification_message(notification, &sequence_display_backlight_on);
37+
notification_message(app->notification, &sequence_display_backlight_on);
3938

4039
//Scene additions
4140
app->view_dispatcher = view_dispatcher_alloc();
@@ -49,30 +48,30 @@ ColorGuess* color_guess_app_alloc() {
4948
app->view_dispatcher, color_guess_tick_event_callback, 100);
5049
view_dispatcher_set_custom_event_callback(
5150
app->view_dispatcher, color_guess_custom_event_callback);
52-
app->submenu = submenu_alloc();
5351

54-
view_dispatcher_add_view(
55-
app->view_dispatcher, ColorGuessViewIdMenu, submenu_get_view(app->submenu));
56-
app->variable_item_list = variable_item_list_alloc();
57-
view_dispatcher_add_view(
58-
app->view_dispatcher,
59-
ColorGuessViewIdSettings,
60-
variable_item_list_get_view(app->variable_item_list));
6152
app->color_guess_startscreen = color_guess_startscreen_alloc();
6253
view_dispatcher_add_view(
6354
app->view_dispatcher,
6455
ColorGuessViewIdStartscreen,
6556
color_guess_startscreen_get_view(app->color_guess_startscreen));
57+
app->submenu = submenu_alloc();
58+
view_dispatcher_add_view(
59+
app->view_dispatcher, ColorGuessViewIdMenu, submenu_get_view(app->submenu));
60+
app->color_guess_play = color_guess_play_alloc();
61+
view_dispatcher_add_view(
62+
app->view_dispatcher,
63+
ColorGuessViewIdPlay,
64+
color_guess_play_get_view(app->color_guess_play));
6665
app->color_guess_color_set = color_guess_color_set_alloc();
6766
view_dispatcher_add_view(
6867
app->view_dispatcher,
6968
ColorGuessViewIdColorSet,
7069
color_guess_color_set_get_view(app->color_guess_color_set));
71-
app->color_guess_play = color_guess_play_alloc();
70+
app->variable_item_list = variable_item_list_alloc();
7271
view_dispatcher_add_view(
7372
app->view_dispatcher,
74-
ColorGuessViewIdPlay,
75-
color_guess_play_get_view(app->color_guess_play));
73+
ColorGuessViewIdSettings,
74+
variable_item_list_get_view(app->variable_item_list));
7675

7776
//End Scene Additions
7877

@@ -86,16 +85,21 @@ void color_guess_app_free(ColorGuess* app) {
8685
scene_manager_free(app->scene_manager);
8786

8887
// View Dispatcher
89-
view_dispatcher_remove_view(app->view_dispatcher, ColorGuessViewIdMenu);
9088
view_dispatcher_remove_view(app->view_dispatcher, ColorGuessViewIdStartscreen);
91-
view_dispatcher_remove_view(app->view_dispatcher, ColorGuessViewIdColorSet);
89+
color_guess_startscreen_free(app->color_guess_startscreen);
90+
view_dispatcher_remove_view(app->view_dispatcher, ColorGuessViewIdMenu);
91+
submenu_free(app->submenu);
9292
view_dispatcher_remove_view(app->view_dispatcher, ColorGuessViewIdPlay);
93+
color_guess_play_free(app->color_guess_play);
94+
view_dispatcher_remove_view(app->view_dispatcher, ColorGuessViewIdColorSet);
95+
color_guess_color_set_free(app->color_guess_color_set);
9396
view_dispatcher_remove_view(app->view_dispatcher, ColorGuessViewIdSettings);
94-
submenu_free(app->submenu);
97+
variable_item_list_free(app->variable_item_list);
9598

9699
view_dispatcher_free(app->view_dispatcher);
97100

98-
// GUI
101+
// Records
102+
furi_record_close(RECORD_NOTIFICATION);
99103
furi_record_close(RECORD_GUI);
100104

101105
app->view_port = NULL;
@@ -113,11 +117,6 @@ int32_t color_guess_app(void* p) {
113117
return 255;
114118
}
115119

116-
if(!furi_hal_region_is_provisioned()) {
117-
color_guess_app_free(app);
118-
return 1;
119-
}
120-
121120
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
122121

123122
scene_manager_next_scene(app->scene_manager, ColorGuessSceneStartscreen);

apps_source_code/color_guess/color_guess.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "views/color_guess_startscreen.h"
1818
#include "helpers/color_guess_storage.h"
1919

20+
#define COLOR_GUESS_VERSION "1.5"
2021
#define TAG "Color_Guess"
2122

2223
typedef struct {
-7.64 KB
Binary file not shown.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
## 1.5
2+
- Additional Memory Management fixes by Willy-JL
3+
- Redraw Issue fixed by Willy-JL
4+
- Added GNU License
5+
- Added version number
6+
7+
## 1.4
8+
- Prevent value changing on win view
9+
- Fix issues with FW build 0.99.x
10+
11+
## 1.3
12+
- Patched Memory Leak in storage
13+
14+
## v1.2
15+
- Updated compatibility to 0.95.0-rc
16+
17+
## v1.1
18+
- Updated Launch Screen GFX
19+
120
## v1.0
221

322
First release to Application Catalog

apps_source_code/color_guess/helpers/color_guess_haptic.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#pragma once
2+
13
#include <notification/notification_messages.h>
24

35
void color_guess_play_happy_bump(void* context);

apps_source_code/color_guess/helpers/color_guess_led.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
#pragma once
22

33
void color_guess_led_set_rgb(void* context, int red, int green, int blue);
44

apps_source_code/color_guess/helpers/color_guess_storage.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ void color_guess_read_settings(void* context) {
8585
FURI_LOG_E(TAG, "Cannot open file %s", COLOR_GUESS_SETTINGS_SAVE_PATH);
8686
color_guess_close_config_file(fff_file);
8787
color_guess_close_storage();
88+
furi_string_free(temp_str);
8889
return;
8990
}
9091

@@ -95,14 +96,15 @@ void color_guess_read_settings(void* context) {
9596
furi_string_free(temp_str);
9697
return;
9798
}
98-
furi_string_free(temp_str);
9999

100100
if(file_version < COLOR_GUESS_SETTINGS_FILE_VERSION) {
101101
FURI_LOG_I(TAG, "old config version, will be removed.");
102102
color_guess_close_config_file(fff_file);
103103
color_guess_close_storage();
104+
furi_string_free(temp_str);
104105
return;
105106
}
107+
furi_string_free(temp_str);
106108

107109
flipper_format_read_uint32(fff_file, COLOR_GUESS_SETTINGS_KEY_HAPTIC, &app->haptic, 1);
108110
flipper_format_read_uint32(fff_file, COLOR_GUESS_SETTINGS_KEY_LED, &app->led, 1);
Loading

0 commit comments

Comments
 (0)