Skip to content

Commit cc5ecab

Browse files
committed
upd camera suite
1 parent f5c4d9d commit cc5ecab

24 files changed

+453
-181
lines changed

base_pack/camera_suite/application.fam

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ App(
77
fap_category="GPIO",
88
fap_description="A camera suite application for the Flipper Zero ESP32-CAM module.",
99
fap_icon="icons/camera_suite.png",
10-
fap_icon_assets="assets",
11-
fap_libs=["assets"],
12-
fap_version="1.4",
10+
fap_version="1.7",
1311
fap_weburl="https://github.com/CodyTolene/Flipper-Zero-Cam",
1412
name="[ESP32] Camera Suite",
1513
order=1,

base_pack/camera_suite/assets/.gitkeep

Whitespace-only changes.
Binary file not shown.

base_pack/camera_suite/camera_suite.c

+15-7
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,18 @@ CameraSuite* camera_suite_app_alloc() {
4343
app->view_dispatcher, camera_suite_custom_event_callback);
4444
app->submenu = submenu_alloc();
4545

46-
// Set defaults, in case no config loaded
47-
app->orientation = 0; // Orientation is "portrait", zero degrees by default.
48-
app->dither = 0; // Dither algorithm is "Floyd Steinberg" by default.
49-
app->flash = 1; // Flash is enabled by default.
46+
// Set app default settings values.
5047
app->haptic = 1; // Haptic is enabled by default
5148
app->jpeg = 0; // Save JPEG to ESP32-CAM sd-card is disabled by default.
5249
app->speaker = 1; // Speaker is enabled by default
5350
app->led = 1; // LED is enabled by default
5451

55-
// Load configs
52+
// Set cam default settings values.
53+
app->orientation = 0; // Orientation is "portrait", zero degrees by default.
54+
app->dither = 0; // Dither algorithm is "Floyd Steinberg" by default.
55+
app->flash = 1; // Flash is enabled by default.
56+
57+
// Load configs if available (overrides defaults).
5658
camera_suite_read_settings(app);
5759

5860
view_dispatcher_add_view(
@@ -81,7 +83,11 @@ CameraSuite* camera_suite_app_alloc() {
8183
app->variable_item_list = variable_item_list_alloc();
8284
view_dispatcher_add_view(
8385
app->view_dispatcher,
84-
CameraSuiteViewIdSettings,
86+
CameraSuiteViewIdAppSettings,
87+
variable_item_list_get_view(app->variable_item_list));
88+
view_dispatcher_add_view(
89+
app->view_dispatcher,
90+
CameraSuiteViewIdCamSettings,
8591
variable_item_list_get_view(app->variable_item_list));
8692

8793
//End Scene Additions
@@ -100,7 +106,8 @@ void camera_suite_app_free(CameraSuite* app) {
100106
view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdMenu);
101107
view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdCamera);
102108
view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdGuide);
103-
view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdSettings);
109+
view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdAppSettings);
110+
view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdCamSettings);
104111
submenu_free(app->submenu);
105112

106113
view_dispatcher_free(app->view_dispatcher);
@@ -110,6 +117,7 @@ void camera_suite_app_free(CameraSuite* app) {
110117
camera_suite_view_start_free(app->camera_suite_view_start);
111118
camera_suite_view_camera_free(app->camera_suite_view_camera);
112119
camera_suite_view_guide_free(app->camera_suite_view_guide);
120+
113121
button_menu_free(app->button_menu);
114122
variable_item_list_free(app->variable_item_list);
115123

base_pack/camera_suite/camera_suite.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ typedef enum {
4545
CameraSuiteViewIdMenu,
4646
CameraSuiteViewIdCamera,
4747
CameraSuiteViewIdGuide,
48-
CameraSuiteViewIdSettings,
48+
CameraSuiteViewIdAppSettings,
49+
CameraSuiteViewIdCamSettings,
4950
} CameraSuiteViewId;
5051

5152
typedef enum {

base_pack/camera_suite/docs/CHANGELOG.md

+27-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
1-
## Roadmap
1+
# Roadmap
22

33
- Store images to onboard ESP32-CAM SD card (partially completed, #24).
44
- Camera preview GUI overlay (#21).
55
- Full screen 90 degree and 270 degree fill (#6).
6+
- WiFi streaming/connection support (#35).
7+
8+
## v1.7
9+
10+
- Add support for new Flipper Zero Firmware UART updates.
11+
- Remove staged WiFi streaming/connection support for now. Until I can fully test.
12+
13+
## v1.6
14+
15+
- Add new splash/start screen.
16+
- Add new module not connected notification + pinout guide in-app.
17+
- Update README with a new "Special Thanks" section.
18+
- Update README "Contributions" section regarding firmware development.
19+
- Separate settings into two views: app and cam settings.
20+
- General code improvements and cleanup.
21+
- Stage new scene for WiFi streaming/connection support (#35).
22+
23+
## v1.5
24+
25+
- Remove usage of image no longer found in the Flipper Zero firmware build.
626

727
## v1.4
828

@@ -12,9 +32,6 @@
1232
- Improve Firmware flashing utility code.
1333
- Improve GitHub actions code.
1434
- Look to mitigate issue "Mirrored Image" #27.
15-
16-
## v1.3.1 (patch)
17-
1835
- Addressed new linting issue with "ufbt" tools.
1936

2037
## v1.3
@@ -36,25 +53,25 @@
3653
- Update documentation to reflect changes.
3754
- Update firmware with new dithering options set.
3855
- Update firmware with new flash support.
39-
- Update repo to reflect https://github.com/CodyTolene/Flipper-Zero-Development-Toolkit for easier tooling.
56+
- Update repo to reflect <https://github.com/CodyTolene/Flipper-Zero-Development-Toolkit> for easier tooling.
4057

4158
## v1.1
4259

4360
- Support and picture stabilization for all camera orientations (0 degree, 90 degree, 180 degree, and 270 degree).
4461
- Rename "Scene 1" to "Camera". No UX changes there.
4562
- Clean up unused "Scene 2". This was inaccessible to users previously and unused.
46-
- Add new dithering variations (requires the latest firmware installation, see here for the installation guide https://github.com/CodyTolene/Flipper-Zero-Camera-Suite#firmware-installation):
63+
- Add new dithering variations (requires the latest firmware installation, see here for the installation guide <https://github.com/CodyTolene/Flipper-Zero-Camera-Suite#firmware-installation>):
4764
- "Jarvis Judice Ninke" dithering option
4865
- "Stucki" dithering option.
4966
- "Floyd-Steinberg" dithering option.
5067
- Cycle through the dithering options with the center button on the Flipper Zero.
51-
- Resolves issue https://github.com/CodyTolene/Flipper-Zero-Camera-Suite/issues/7
52-
- Resolves issue https://github.com/CodyTolene/Flipper-Zero-Camera-Suite/pull/17
68+
- Resolves issue <https://github.com/CodyTolene/Flipper-Zero-Camera-Suite/issues/7>
69+
- Resolves issue <https://github.com/CodyTolene/Flipper-Zero-Camera-Suite/pull/17>
5370

5471
## v1.0
5572

56-
- Builds upon Z4urce's software found here (updated 6 months ago): https://github.com/Z4urce/flipperzero-camera
57-
- Utilizes the superb C boilerplate examples laid out by leedave (updated last month): https://github.com/leedave/flipper-zero-fap-boilerplate
73+
- Builds upon Z4urce's software found here (updated 6 months ago): <https://github.com/Z4urce/flipperzero-camera>
74+
- Utilizes the superb C boilerplate examples laid out by leedave (updated last month): <https://github.com/leedave/flipper-zero-fap-boilerplate>
5875
- Builds upon the "Camera" software into the new "Camera Suite" application with new usage:
5976
- Add a scene for a guide.
6077
- Add a scene for settings.

base_pack/camera_suite/docs/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Firmware is needed for the ESP32-CAM module, see here for more information: http
1010

1111
Button mappings:
1212

13-
**Up** = Contrast Up
13+
**Up** = Contrast Up.
1414

15-
**Down** = Contrast Down
15+
**Down** = Contrast Down.
1616

1717
**Left** = Toggle invert.
1818

@@ -30,8 +30,8 @@ Settings:
3030

3131
**Dithering Type** Change between the Cycle Floyd–Steinberg, Jarvis-Judice-Ninke, and Stucki dithering types.
3232

33-
**Haptic FX** = Toggle haptic feedback on/off.
33+
**Haptic Effects** = Toggle haptic feedback on/off.
3434

35-
**Sound FX** = Toggle sound effects on/off.
35+
**Sound Effects** = Toggle sound effects on/off.
3636

37-
**LED FX** = Toggle LED effects on/off.
37+
**LED Effects** = Toggle LED effects on/off.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#include "../camera_suite.h"
2+
#include <lib/toolbox/value_index.h>
3+
4+
const char* const haptic_text[2] = {
5+
"OFF",
6+
"ON",
7+
};
8+
9+
const uint32_t haptic_value[2] = {
10+
CameraSuiteHapticOff,
11+
CameraSuiteHapticOn,
12+
};
13+
14+
const char* const speaker_text[2] = {
15+
"OFF",
16+
"ON",
17+
};
18+
19+
const uint32_t speaker_value[2] = {
20+
CameraSuiteSpeakerOff,
21+
CameraSuiteSpeakerOn,
22+
};
23+
24+
const char* const led_text[2] = {
25+
"OFF",
26+
"ON",
27+
};
28+
29+
const uint32_t led_value[2] = {
30+
CameraSuiteLedOff,
31+
CameraSuiteLedOn,
32+
};
33+
34+
static void camera_suite_scene_app_settings_set_haptic(VariableItem* item) {
35+
CameraSuite* app = variable_item_get_context(item);
36+
uint8_t index = variable_item_get_current_value_index(item);
37+
38+
variable_item_set_current_value_text(item, haptic_text[index]);
39+
app->haptic = haptic_value[index];
40+
}
41+
42+
static void camera_suite_scene_app_settings_set_speaker(VariableItem* item) {
43+
CameraSuite* app = variable_item_get_context(item);
44+
uint8_t index = variable_item_get_current_value_index(item);
45+
variable_item_set_current_value_text(item, speaker_text[index]);
46+
app->speaker = speaker_value[index];
47+
}
48+
49+
static void camera_suite_scene_app_settings_set_led(VariableItem* item) {
50+
CameraSuite* app = variable_item_get_context(item);
51+
uint8_t index = variable_item_get_current_value_index(item);
52+
variable_item_set_current_value_text(item, led_text[index]);
53+
app->led = led_value[index];
54+
}
55+
56+
void camera_suite_scene_app_settings_submenu_callback(void* context, uint32_t index) {
57+
CameraSuite* app = context;
58+
view_dispatcher_send_custom_event(app->view_dispatcher, index);
59+
}
60+
61+
void camera_suite_scene_app_settings_on_enter(void* context) {
62+
CameraSuite* app = context;
63+
VariableItem* item;
64+
uint8_t value_index;
65+
66+
// Haptic Effects ON/OFF
67+
item = variable_item_list_add(
68+
app->variable_item_list,
69+
"Haptic Effects:",
70+
2,
71+
camera_suite_scene_app_settings_set_haptic,
72+
app);
73+
value_index = value_index_uint32(app->haptic, haptic_value, 2);
74+
variable_item_set_current_value_index(item, value_index);
75+
variable_item_set_current_value_text(item, haptic_text[value_index]);
76+
77+
// Sound Effects ON/OFF
78+
item = variable_item_list_add(
79+
app->variable_item_list,
80+
"Sound Effects:",
81+
2,
82+
camera_suite_scene_app_settings_set_speaker,
83+
app);
84+
value_index = value_index_uint32(app->speaker, speaker_value, 2);
85+
variable_item_set_current_value_index(item, value_index);
86+
variable_item_set_current_value_text(item, speaker_text[value_index]);
87+
88+
// LED Effects ON/OFF
89+
item = variable_item_list_add(
90+
app->variable_item_list, "LED Effects:", 2, camera_suite_scene_app_settings_set_led, app);
91+
value_index = value_index_uint32(app->led, led_value, 2);
92+
variable_item_set_current_value_index(item, value_index);
93+
variable_item_set_current_value_text(item, led_text[value_index]);
94+
95+
view_dispatcher_switch_to_view(app->view_dispatcher, CameraSuiteViewIdAppSettings);
96+
}
97+
98+
bool camera_suite_scene_app_settings_on_event(void* context, SceneManagerEvent event) {
99+
CameraSuite* app = context;
100+
UNUSED(app);
101+
bool consumed = false;
102+
if(event.type == SceneManagerEventTypeCustom) {
103+
}
104+
return consumed;
105+
}
106+
107+
void camera_suite_scene_app_settings_on_exit(void* context) {
108+
CameraSuite* app = context;
109+
variable_item_list_set_selected_item(app->variable_item_list, 0);
110+
variable_item_list_reset(app->variable_item_list);
111+
}

0 commit comments

Comments
 (0)