Skip to content

Commit

Permalink
Merge pull request #22 from CodyTolene/ct/picture-and-flash-support
Browse files Browse the repository at this point in the history
Save picture support + flash support + configurable dithering in settings.
  • Loading branch information
CodyTolene committed Aug 6, 2023
2 parents 12b88ff + ba56342 commit 1fee78d
Show file tree
Hide file tree
Showing 17 changed files with 283 additions and 225 deletions.
190 changes: 0 additions & 190 deletions .clang-format

This file was deleted.

File renamed without changes
Binary file added .github/images/v1-2.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
.vscode
*.zip
.DS_Store
.clang-format
.editorconfig
.idea
.vscode
/venv
__pycache__
dist/*
src-fap/.gitignore
.submodules/*
7 changes: 7 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[submodule ".submodules/flipper-application-catalog"]
path = .submodules/flipper-application-catalog
url = https://github.com/flipperdevices/flipper-application-catalog
[submodule ".submodules/flipperzero-firmware"]
path = .submodules/flipperzero-firmware
url = https://github.com/flipperdevices/flipperzero-firmware
branch = dev
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,25 @@
- [Software Guide](#software-guide)
- [Attributions](#attributions)
- [Contributions](#contributions)
- [Changelog](CHANGELOG.md)

## Previews <a name="previews"></a>

<img align="center" src=".github/images/preview_01.png" />
Greetings!

<img align="center" src=".github/images/preview_02.png" />
- <img align="center" src=".github/images/preview_01.png" />

<img align="center" src=".github/images/preview.gif" />
Preview with a camera module attached to the Flipper Zero.

- <img align="center" src=".github/images/preview_02.png" />

Version 1.1.0 and above now supports new dithering options and bug fixes!

- <img align="center" src=".github/images/v1-1.gif" />

Version 1.2.0 and above now supports taking pictures, configurable dithering, and LED flash!

- <img align="center" src=".github/images/v1-2.gif" />

<p align="right">[ <a href="#index">Back to top</a> ]</p>

Expand Down Expand Up @@ -122,14 +133,16 @@ Note the upload may fail a few times, this is normal, try again. If it still fai

▶️ = Toggle dithering on/off.

⚪ = Cycle Floyd–Steinberg/Jarvis-Judice-Ninke/Stucki dithering types.
⚪ = Take a picture and save to the "DCIM" folder at the root of your SD card. Image will be saved as a bitmap file with a timestamp as the filename ("YYYYMMDD-HHMMSS.bmp"). If flash is on in the settings (enabled by default) the ESP32-CAM onboard LED will light up when the picture is taken.

↩️ = Go back.

### Camera Suite settings:

**Orientation** = Rotate the camera image 90 degrees counter-clockwise starting at zero by default (0, 90, 180, 270). This is useful if you have your camera module mounted in a different orientation than the default.

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

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

**Sound FX** = Toggle sound effects on/off.
Expand Down
2 changes: 1 addition & 1 deletion src-fap/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ App(
fap_description="A camera suite application for the Flipper Zero ESP32-CAM module.",
fap_icon="icons/camera_suite.png",
fap_libs=["assets"],
fap_version="1.1",
fap_version="1.2",
fap_weburl="https://github.com/CodyTolene/Flipper-Zero-Cam",
name="[ESP32] Camera Suite",
order=1,
Expand Down
8 changes: 5 additions & 3 deletions src-fap/camera_suite.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ CameraSuite* camera_suite_app_alloc() {

// Set defaults, in case no config loaded
app->orientation = 0; // Orientation is "portrait", zero degrees by default.
app->haptic = 1; // Haptic is on by default
app->speaker = 1; // Speaker is on by default
app->led = 1; // LED is on by default
app->dither = 0; // Dither algorithm is "Floyd Steinberg" by default.
app->flash = 1; // Flash is enabled by default.
app->haptic = 1; // Haptic is enabled by default
app->speaker = 1; // Speaker is enabled by default
app->led = 1; // LED is enabled by default

// Load configs
camera_suite_read_settings(app);
Expand Down
13 changes: 13 additions & 0 deletions src-fap/camera_suite.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ typedef struct {
CameraSuiteViewCamera* camera_suite_view_camera;
CameraSuiteViewGuide* camera_suite_view_guide;
uint32_t orientation;
uint32_t dither;
uint32_t flash;
uint32_t haptic;
uint32_t speaker;
uint32_t led;
Expand All @@ -51,6 +53,17 @@ typedef enum {
CameraSuiteOrientation270,
} CameraSuiteOrientationState;

typedef enum {
CameraSuiteDitherFloydSteinberg,
CameraSuiteDitherStucki,
CameraSuiteDitherJarvisJudiceNinke,
} CameraSuiteDitherState;

typedef enum {
CameraSuiteFlashOff,
CameraSuiteFlashOn,
} CameraSuiteFlashState;

typedef enum {
CameraSuiteHapticOff,
CameraSuiteHapticOn,
Expand Down
15 changes: 12 additions & 3 deletions src-fap/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
## Roadmap

- Save image support.
- Full screen 90 degree and 270 degree fill.
- Camera flash support.
- In-camera GUI.

## v1.1 (current)
## v1.2 (current)

- Save image support. When the center button is pressed take a picture and save it to the "DCIM" folder at the root of your SD card. The image will be saved as a bitmap file with a timestamp as the filename ("YYYYMMDD-HHMMSS.bmp").
- Camera flash support. Flashes the ESP32-CAM onboard LED when a picture is taken if enabled in the settings.
- Move the camera dithering type to the settings scene as a new configurable option.
- Add "Flash" option to the settings scene as a new configurable option.
- 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.

## 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.
Expand Down
4 changes: 3 additions & 1 deletion src-fap/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ Button mappings:

**Right** = Toggle dithering on/off.

**Center** = Cycle Floyd–Steinberg/Jarvis-Judice-Ninke/Stucki dithering types.
**Center** = Take a picture and save to the "DCIM" folder at the root of your SD card. Image will be saved as a bitmap file with a timestamp as the filename ("YYYYMMDD-HHMMSS.bmp"). If flash is on in the settings (enabled by default) the ESP32-CAM onboard LED will light up when the picture is taken.

**Back** = Go back.

Settings:

**Orientation** = Rotate the camera image 90 degrees counter-clockwise starting at zero by default (0, 90, 180, 270). This is useful if you have your camera module mounted in a different orientation than the default.

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

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

**Sound FX** = Toggle sound effects on/off.
Expand Down
5 changes: 5 additions & 0 deletions src-fap/helpers/camera_suite_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ void camera_suite_save_settings(void* context) {
fff_file, BOILERPLATE_SETTINGS_HEADER, BOILERPLATE_SETTINGS_FILE_VERSION);
flipper_format_write_uint32(
fff_file, BOILERPLATE_SETTINGS_KEY_ORIENTATION, &app->orientation, 1);
flipper_format_write_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_DITHER, &app->dither, 1);
flipper_format_write_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_FLASH, &app->flash, 1);
flipper_format_write_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_HAPTIC, &app->haptic, 1);
flipper_format_write_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_SPEAKER, &app->speaker, 1);
flipper_format_write_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_LED, &app->led, 1);
Expand Down Expand Up @@ -100,8 +102,11 @@ void camera_suite_read_settings(void* context) {
return;
}

// Read settings
flipper_format_read_uint32(
fff_file, BOILERPLATE_SETTINGS_KEY_ORIENTATION, &app->orientation, 1);
flipper_format_read_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_DITHER, &app->dither, 1);
flipper_format_read_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_FLASH, &app->flash, 1);
flipper_format_read_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_HAPTIC, &app->haptic, 1);
flipper_format_read_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_SPEAKER, &app->speaker, 1);
flipper_format_read_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_LED, &app->led, 1);
Expand Down
2 changes: 2 additions & 0 deletions src-fap/helpers/camera_suite_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#define BOILERPLATE_SETTINGS_SAVE_PATH_TMP BOILERPLATE_SETTINGS_SAVE_PATH ".tmp"
#define BOILERPLATE_SETTINGS_HEADER "Camera Suite Config File"
#define BOILERPLATE_SETTINGS_KEY_ORIENTATION "Orientation"
#define BOILERPLATE_SETTINGS_KEY_DITHER "Dither"
#define BOILERPLATE_SETTINGS_KEY_FLASH "Flash"
#define BOILERPLATE_SETTINGS_KEY_HAPTIC "Haptic"
#define BOILERPLATE_SETTINGS_KEY_LED "Led"
#define BOILERPLATE_SETTINGS_KEY_SPEAKER "Speaker"
Expand Down

0 comments on commit 1fee78d

Please sign in to comment.