Skip to content

Commit

Permalink
upd camera suite
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Mar 15, 2024
1 parent f5c4d9d commit cc5ecab
Show file tree
Hide file tree
Showing 24 changed files with 453 additions and 181 deletions.
4 changes: 1 addition & 3 deletions base_pack/camera_suite/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ App(
fap_category="GPIO",
fap_description="A camera suite application for the Flipper Zero ESP32-CAM module.",
fap_icon="icons/camera_suite.png",
fap_icon_assets="assets",
fap_libs=["assets"],
fap_version="1.4",
fap_version="1.7",
fap_weburl="https://github.com/CodyTolene/Flipper-Zero-Cam",
name="[ESP32] Camera Suite",
order=1,
Expand Down
Empty file.
Binary file not shown.
22 changes: 15 additions & 7 deletions base_pack/camera_suite/camera_suite.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,18 @@ CameraSuite* camera_suite_app_alloc() {
app->view_dispatcher, camera_suite_custom_event_callback);
app->submenu = submenu_alloc();

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

// Load configs
// Set cam default settings values.
app->orientation = 0; // Orientation is "portrait", zero degrees by default.
app->dither = 0; // Dither algorithm is "Floyd Steinberg" by default.
app->flash = 1; // Flash is enabled by default.

// Load configs if available (overrides defaults).
camera_suite_read_settings(app);

view_dispatcher_add_view(
Expand Down Expand Up @@ -81,7 +83,11 @@ CameraSuite* camera_suite_app_alloc() {
app->variable_item_list = variable_item_list_alloc();
view_dispatcher_add_view(
app->view_dispatcher,
CameraSuiteViewIdSettings,
CameraSuiteViewIdAppSettings,
variable_item_list_get_view(app->variable_item_list));
view_dispatcher_add_view(
app->view_dispatcher,
CameraSuiteViewIdCamSettings,
variable_item_list_get_view(app->variable_item_list));

//End Scene Additions
Expand All @@ -100,7 +106,8 @@ void camera_suite_app_free(CameraSuite* app) {
view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdMenu);
view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdCamera);
view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdGuide);
view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdSettings);
view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdAppSettings);
view_dispatcher_remove_view(app->view_dispatcher, CameraSuiteViewIdCamSettings);
submenu_free(app->submenu);

view_dispatcher_free(app->view_dispatcher);
Expand All @@ -110,6 +117,7 @@ void camera_suite_app_free(CameraSuite* app) {
camera_suite_view_start_free(app->camera_suite_view_start);
camera_suite_view_camera_free(app->camera_suite_view_camera);
camera_suite_view_guide_free(app->camera_suite_view_guide);

button_menu_free(app->button_menu);
variable_item_list_free(app->variable_item_list);

Expand Down
3 changes: 2 additions & 1 deletion base_pack/camera_suite/camera_suite.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ typedef enum {
CameraSuiteViewIdMenu,
CameraSuiteViewIdCamera,
CameraSuiteViewIdGuide,
CameraSuiteViewIdSettings,
CameraSuiteViewIdAppSettings,
CameraSuiteViewIdCamSettings,
} CameraSuiteViewId;

typedef enum {
Expand Down
37 changes: 27 additions & 10 deletions base_pack/camera_suite/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
## Roadmap
# Roadmap

- Store images to onboard ESP32-CAM SD card (partially completed, #24).
- Camera preview GUI overlay (#21).
- Full screen 90 degree and 270 degree fill (#6).
- WiFi streaming/connection support (#35).

## v1.7

- Add support for new Flipper Zero Firmware UART updates.
- Remove staged WiFi streaming/connection support for now. Until I can fully test.

## v1.6

- Add new splash/start screen.
- Add new module not connected notification + pinout guide in-app.
- Update README with a new "Special Thanks" section.
- Update README "Contributions" section regarding firmware development.
- Separate settings into two views: app and cam settings.
- General code improvements and cleanup.
- Stage new scene for WiFi streaming/connection support (#35).

## v1.5

- Remove usage of image no longer found in the Flipper Zero firmware build.

## v1.4

Expand All @@ -12,9 +32,6 @@
- Improve Firmware flashing utility code.
- Improve GitHub actions code.
- Look to mitigate issue "Mirrored Image" #27.

## v1.3.1 (patch)

- Addressed new linting issue with "ufbt" tools.

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

## v1.1

- Support and picture stabilization for all camera orientations (0 degree, 90 degree, 180 degree, and 270 degree).
- Rename "Scene 1" to "Camera". No UX changes there.
- Clean up unused "Scene 2". This was inaccessible to users previously and unused.
- 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):
- 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>):
- "Jarvis Judice Ninke" dithering option
- "Stucki" dithering option.
- "Floyd-Steinberg" dithering option.
- Cycle through the dithering options with the center button on the Flipper Zero.
- Resolves issue https://github.com/CodyTolene/Flipper-Zero-Camera-Suite/issues/7
- Resolves issue https://github.com/CodyTolene/Flipper-Zero-Camera-Suite/pull/17
- Resolves issue <https://github.com/CodyTolene/Flipper-Zero-Camera-Suite/issues/7>
- Resolves issue <https://github.com/CodyTolene/Flipper-Zero-Camera-Suite/pull/17>

## v1.0

- Builds upon Z4urce's software found here (updated 6 months ago): https://github.com/Z4urce/flipperzero-camera
- Utilizes the superb C boilerplate examples laid out by leedave (updated last month): https://github.com/leedave/flipper-zero-fap-boilerplate
- Builds upon Z4urce's software found here (updated 6 months ago): <https://github.com/Z4urce/flipperzero-camera>
- Utilizes the superb C boilerplate examples laid out by leedave (updated last month): <https://github.com/leedave/flipper-zero-fap-boilerplate>
- Builds upon the "Camera" software into the new "Camera Suite" application with new usage:
- Add a scene for a guide.
- Add a scene for settings.
Expand Down
10 changes: 5 additions & 5 deletions base_pack/camera_suite/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Firmware is needed for the ESP32-CAM module, see here for more information: http

Button mappings:

**Up** = Contrast Up
**Up** = Contrast Up.

**Down** = Contrast Down
**Down** = Contrast Down.

**Left** = Toggle invert.

Expand All @@ -30,8 +30,8 @@ Settings:

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

**Haptic FX** = Toggle haptic feedback on/off.
**Haptic Effects** = Toggle haptic feedback on/off.

**Sound FX** = Toggle sound effects on/off.
**Sound Effects** = Toggle sound effects on/off.

**LED FX** = Toggle LED effects on/off.
**LED Effects** = Toggle LED effects on/off.
111 changes: 111 additions & 0 deletions base_pack/camera_suite/scenes/camera_suite_scene_app_settings.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#include "../camera_suite.h"
#include <lib/toolbox/value_index.h>

const char* const haptic_text[2] = {
"OFF",
"ON",
};

const uint32_t haptic_value[2] = {
CameraSuiteHapticOff,
CameraSuiteHapticOn,
};

const char* const speaker_text[2] = {
"OFF",
"ON",
};

const uint32_t speaker_value[2] = {
CameraSuiteSpeakerOff,
CameraSuiteSpeakerOn,
};

const char* const led_text[2] = {
"OFF",
"ON",
};

const uint32_t led_value[2] = {
CameraSuiteLedOff,
CameraSuiteLedOn,
};

static void camera_suite_scene_app_settings_set_haptic(VariableItem* item) {
CameraSuite* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);

variable_item_set_current_value_text(item, haptic_text[index]);
app->haptic = haptic_value[index];
}

static void camera_suite_scene_app_settings_set_speaker(VariableItem* item) {
CameraSuite* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, speaker_text[index]);
app->speaker = speaker_value[index];
}

static void camera_suite_scene_app_settings_set_led(VariableItem* item) {
CameraSuite* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, led_text[index]);
app->led = led_value[index];
}

void camera_suite_scene_app_settings_submenu_callback(void* context, uint32_t index) {
CameraSuite* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, index);
}

void camera_suite_scene_app_settings_on_enter(void* context) {
CameraSuite* app = context;
VariableItem* item;
uint8_t value_index;

// Haptic Effects ON/OFF
item = variable_item_list_add(
app->variable_item_list,
"Haptic Effects:",
2,
camera_suite_scene_app_settings_set_haptic,
app);
value_index = value_index_uint32(app->haptic, haptic_value, 2);
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, haptic_text[value_index]);

// Sound Effects ON/OFF
item = variable_item_list_add(
app->variable_item_list,
"Sound Effects:",
2,
camera_suite_scene_app_settings_set_speaker,
app);
value_index = value_index_uint32(app->speaker, speaker_value, 2);
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, speaker_text[value_index]);

// LED Effects ON/OFF
item = variable_item_list_add(
app->variable_item_list, "LED Effects:", 2, camera_suite_scene_app_settings_set_led, app);
value_index = value_index_uint32(app->led, led_value, 2);
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, led_text[value_index]);

view_dispatcher_switch_to_view(app->view_dispatcher, CameraSuiteViewIdAppSettings);
}

bool camera_suite_scene_app_settings_on_event(void* context, SceneManagerEvent event) {
CameraSuite* app = context;
UNUSED(app);
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
}
return consumed;
}

void camera_suite_scene_app_settings_on_exit(void* context) {
CameraSuite* app = context;
variable_item_list_set_selected_item(app->variable_item_list, 0);
variable_item_list_reset(app->variable_item_list);
}
Loading

0 comments on commit cc5ecab

Please sign in to comment.