Skip to content

Commit f8d3779

Browse files
committed
Squashed 'applications/external/' changes from 400bd29e100..0cbe0421ee4
0cbe0421ee4 Format e352a9e0b65 WAV Player: Reconfigure to use 8-bit memory buffer, halving memory usage 0f51370211e Merge jetpack_joyride from https://github.com/timstrasser/flipper-jetpack-game 985c4342fdc Merge camera_suite from https://github.com/CodyTolene/Flipper-Zero-Camera-Suite 847f0f0 Bump version a9ecea40755 Update changelog 470c1f645bc Fix up horizontal flip when camera is rotated 180 degrees dcefdf1c791 Update in-app pinout guide, readme, and version. 8669013 Merge pull request #4 from CookiePLMonster/master ca74bc2 Updated to SDK 0.103 5fd43f8dbe7 Merge branch 'dev' into ct/v1.8.0 4ac83ef3814 Use new DateTime. git-subtree-dir: applications/external git-subtree-split: 0cbe0421ee4c09465dc9a265f202437cbf1967c5
1 parent d72de6a commit f8d3779

10 files changed

+38
-50
lines changed

camera_suite/application.fam

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ App(
77
fap_category="GPIO/ESP",
88
fap_description="A camera suite application for the Flipper Zero ESP32-CAM module.",
99
fap_icon="icons/camera_suite.png",
10-
fap_version="1.7",
10+
fap_version="1.8",
1111
fap_weburl="https://github.com/CodyTolene/Flipper-Zero-Cam",
1212
name="[ESP32CAM] Camera Suite",
1313
order=1,

camera_suite/docs/CHANGELOG.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
- Full screen 90 degree and 270 degree fill (#6).
66
- WiFi streaming/connection support (#35).
77

8+
## v1.8
9+
10+
- Use new Flipper Zero "DateTime" type for image filenames as "YYYYMMDD-HHMMSS.bmp" (#52).
11+
- Fix pinout guide image in-app for "GND-GND" pin reference (#59). Thanks PyroJoe313!
12+
- Fix up horizontal flip when camera is rotated 180 degrees (#57). Thanks 4k3or3et!
13+
814
## v1.7
915

1016
- Add support for new Flipper Zero Firmware UART updates.
@@ -31,7 +37,7 @@
3137
- Improve Firmware code (requires reflash).
3238
- Improve Firmware flashing utility code.
3339
- Improve GitHub actions code.
34-
- Look to mitigate issue "Mirrored Image" #27.
40+
- Look to mitigate issue "Mirrored Image" (#27).
3541
- Addressed new linting issue with "ufbt" tools.
3642

3743
## v1.3
@@ -42,11 +48,12 @@
4248
- Bug Fix: Addressed picture inversion issue reported by user leedave. Thanks for your contribution! (Closes #23)
4349
- Code Refinement: Enhanced firmware code for readability and maintainability. Separated concerns into individual files for a more organized structure.
4450
- Technical Improvements: Implemented general code enhancements and introduced syntactic sugar for cleaner, more efficient code.
45-
- Work in Progress: Added a new test function for saving pictures to the onboard ESP32-CAM SD card. This feature is under development and will allow users to save pictures directly to the SD card in the future. Tracked under feature request #24.
51+
- Work in Progress: Added a new test function for saving pictures to the onboard ESP32-CAM SD card (#24).
4652

4753
## v1.2
4854

49-
- 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").
55+
- 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.
56+
- Image will be saved as a bitmap file with a timestamp as the filename ("YYYYMMDD-HHMMSS.bmp").
5057
- Camera flash support. Flashes the ESP32-CAM onboard LED when a picture is taken if enabled in the settings.
5158
- Move the camera dithering type to the settings scene as a new configurable option.
5259
- Add "Flash" option to the settings scene as a new configurable option.

camera_suite/views/camera_suite_view_camera.c

+8-29
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static void draw_pixel_by_orientation(Canvas* canvas, uint8_t x, uint8_t y, uint
2626
break;
2727
}
2828
case 2: { // Camera rotated 180 degrees (upside down)
29-
canvas_draw_dot(canvas, FRAME_WIDTH - 1 - x, FRAME_HEIGHT - 1 - y);
29+
canvas_draw_dot(canvas, x, FRAME_HEIGHT - 1 - y);
3030
break;
3131
}
3232
case 3: { // Camera rotated 270 degrees
@@ -64,10 +64,11 @@ static void camera_suite_view_camera_draw(Canvas* canvas, void* model) {
6464
// Clear the screen.
6565
canvas_clear(canvas);
6666

67-
// Draw the ESP32-CAM module.
67+
// Set the font to the secondary font.
6868
canvas_set_font(canvas, FontSecondary);
69+
70+
// Draw the ESP32-CAM module.
6971
canvas_draw_str(canvas, 47, 50, "ESP32");
70-
canvas_set_font(canvas, FontSecondary);
7172
canvas_draw_str(canvas, 52, 58, "CAM");
7273
canvas_draw_dot(canvas, 84, 3);
7374
canvas_draw_box(canvas, 50, 35, 23, 7);
@@ -114,7 +115,7 @@ static void camera_suite_view_camera_draw(Canvas* canvas, void* model) {
114115
canvas_draw_frame(canvas, 78, 40, 5, 5);
115116

116117
// Draw the pinout lines.
117-
canvas_draw_line(canvas, 39, 8, 21, 8);
118+
canvas_draw_line(canvas, 39, 12, 21, 12);
118119
canvas_draw_line(canvas, 87, 24, 83, 24);
119120
canvas_draw_line(canvas, 87, 32, 83, 32);
120121
canvas_draw_line(canvas, 88, 23, 88, 13);
@@ -124,27 +125,18 @@ static void camera_suite_view_camera_draw(Canvas* canvas, void* model) {
124125
canvas_draw_line(canvas, 126, 44, 89, 44);
125126

126127
// Draw the pinout labels.
127-
canvas_set_font(canvas, FontSecondary);
128128
canvas_draw_str(canvas, 91, 11, "VCC-3V");
129-
canvas_set_font(canvas, FontSecondary);
130129
canvas_draw_str(canvas, 91, 27, "U0R-TX");
131-
canvas_set_font(canvas, FontSecondary);
132130
canvas_draw_str(canvas, 91, 43, "U0T-RX");
133-
canvas_set_font(canvas, FontSecondary);
134-
canvas_draw_str(canvas, 2, 12, "GND");
135-
canvas_set_font(canvas, FontSecondary);
136-
canvas_draw_str(canvas, 12, 21, "-GND");
131+
canvas_draw_str(canvas, 2, 16, "GND");
132+
canvas_draw_str(canvas, 12, 25, "-GND");
137133

138134
// Draw the "Please Connect Module!" text.
139-
canvas_set_font(canvas, FontSecondary);
140135
canvas_draw_str(canvas, 2, 40, "Please");
141-
canvas_set_font(canvas, FontSecondary);
142136
canvas_draw_str(canvas, 2, 49, "Connect");
143-
canvas_set_font(canvas, FontSecondary);
144137
canvas_draw_str(canvas, 2, 58, "Module!");
145138

146139
// Draw the "Back" text and button logo.
147-
canvas_set_font(canvas, FontSecondary);
148140
canvas_draw_str(canvas, 92, 57, "Back");
149141
canvas_draw_line(canvas, 116, 49, 116, 53);
150142
canvas_draw_line(canvas, 115, 50, 115, 52);
@@ -179,20 +171,11 @@ static void save_image_to_flipper_sd_card(void* model) {
179171
FuriString* file_name = furi_string_alloc();
180172

181173
// Get the current date and time.
182-
183-
// Not supported in "Release" F0 build.
184-
// TODO: Remove when DateTime is supported in "Release" F0 build.
185-
// FuriHalRtcDateTime datetime = {0};
186-
187-
// Only supported in "RC" & "Dev" builds.
188-
// TODO: Uncomment when DateTime is supported in "Release" F0 build.
189174
DateTime datetime = {0};
190175

191-
// TODO: Uncomment when DateTime is supported in "Release" F0 build.
192176
furi_hal_rtc_get_datetime(&datetime);
193177

194-
// Create the file name using DateTime.
195-
// TODO: Uncomment when DateTime is supported in "Release" F0 build.
178+
// Create the file name.
196179
furi_string_printf(
197180
file_name,
198181
EXT_PATH("DCIM/%.4d%.2d%.2d-%.2d%.2d%.2d.bmp"),
@@ -203,10 +186,6 @@ static void save_image_to_flipper_sd_card(void* model) {
203186
datetime.minute,
204187
datetime.second);
205188

206-
// Just use a random number for now instead of DateTime.
207-
// int random_number = rand();
208-
// furi_string_printf(file_name, EXT_PATH("DCIM/%d.bmp"), random_number);
209-
210189
// Open the file for writing. If the file does not exist (it shouldn't),
211190
// create it.
212191
bool result =

jetpack_joyride/application.fam

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ App(
1313
fap_category="Games",
1414
fap_icon_assets="assets",
1515
fap_icon_assets_symbol="jetpack_game",
16+
fap_version="1.1",
1617
)

jetpack_joyride/jetpack.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -251,18 +251,18 @@ static void jetpack_game_render_callback(Canvas* const canvas, void* ctx) {
251251
furi_mutex_release(game_state->mutex);
252252
}
253253

254-
static void jetpack_game_input_callback(InputEvent* input_event, void* ctx) {
255-
furi_assert(ctx);
256-
FuriMessageQueue* event_queue = ctx;
254+
static void jetpack_game_input_callback(InputEvent* input_event, void* context) {
255+
furi_assert(context);
257256

257+
FuriMessageQueue* event_queue = context;
258258
GameEvent event = {.type = EventTypeKey, .input = *input_event};
259259
furi_message_queue_put(event_queue, &event, FuriWaitForever);
260260
}
261261

262-
static void jetpack_game_update_timer_callback(void* ctx) {
263-
furi_assert(ctx);
264-
FuriMessageQueue* event_queue = ctx;
262+
static void jetpack_game_update_timer_callback(void* context) {
263+
furi_assert(context);
265264

265+
FuriMessageQueue* event_queue = context;
266266
GameEvent event = {.type = EventTypeTick};
267267
furi_message_queue_put(event_queue, &event, 0);
268268
}

wav_player/wav_parser.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ typedef struct {
5050
Storage* storage;
5151
Stream* stream;
5252
WavParser* parser;
53-
uint16_t* sample_buffer;
53+
uint8_t* sample_buffer;
5454
uint8_t* tmp_buffer;
5555

5656
uint32_t sample_rate;

wav_player/wav_player.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ static WavPlayerApp* app_alloc() {
9191
app->storage = furi_record_open(RECORD_STORAGE);
9292
app->stream = file_stream_alloc(app->storage);
9393
app->parser = wav_parser_alloc();
94-
app->sample_buffer = malloc(sizeof(uint16_t) * app->samples_count);
95-
app->tmp_buffer = malloc(sizeof(uint8_t) * app->samples_count);
94+
app->sample_buffer = malloc(sizeof(*app->sample_buffer) * app->samples_count);
95+
app->tmp_buffer = malloc(sizeof(*app->tmp_buffer) * app->samples_count);
9696
app->queue = furi_message_queue_alloc(10, sizeof(WavPlayerEvent));
9797

9898
app->volume = 10.0f;
@@ -137,7 +137,7 @@ static void app_free(WavPlayerApp* app) {
137137
// TODO: that works only with 8-bit 2ch audio
138138
static bool fill_data(WavPlayerApp* app, size_t index) {
139139
if(app->num_channels == 1 && app->bits_per_sample == 8) {
140-
uint16_t* sample_buffer_start = &app->sample_buffer[index];
140+
uint8_t* sample_buffer_start = &app->sample_buffer[index];
141141
size_t count = stream_read(app->stream, app->tmp_buffer, app->samples_count_half);
142142

143143
for(size_t i = count; i < app->samples_count_half; i++) {
@@ -176,7 +176,7 @@ static bool fill_data(WavPlayerApp* app, size_t index) {
176176
}
177177

178178
if(app->num_channels == 1 && app->bits_per_sample == 16) {
179-
uint16_t* sample_buffer_start = &app->sample_buffer[index];
179+
uint8_t* sample_buffer_start = &app->sample_buffer[index];
180180
size_t count = stream_read(app->stream, app->tmp_buffer, app->samples_count);
181181

182182
for(size_t i = count; i < app->samples_count; i++) {
@@ -214,7 +214,7 @@ static bool fill_data(WavPlayerApp* app, size_t index) {
214214
}
215215

216216
if(app->num_channels == 2 && app->bits_per_sample == 16) {
217-
uint16_t* sample_buffer_start = &app->sample_buffer[index];
217+
uint8_t* sample_buffer_start = &app->sample_buffer[index];
218218
size_t count = stream_read(app->stream, app->tmp_buffer, app->samples_count);
219219

220220
for(size_t i = 0; i < app->samples_count; i += 4) {
@@ -277,7 +277,7 @@ static bool fill_data(WavPlayerApp* app, size_t index) {
277277
}
278278

279279
if(app->num_channels == 2 && app->bits_per_sample == 8) {
280-
uint16_t* sample_buffer_start = &app->sample_buffer[index];
280+
uint8_t* sample_buffer_start = &app->sample_buffer[index];
281281
size_t count = stream_read(app->stream, app->tmp_buffer, app->samples_count);
282282

283283
for(size_t i = count; i < app->samples_count; i++) {

wav_player/wav_player_hal.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ void wav_player_speaker_init(uint32_t sample_rate) {
3838
TIM_InitStruct.Prescaler = 0;
3939
//TIM_InitStruct.Autoreload = 1451; //64 000 000 / 1451 ~= 44100 Hz
4040

41-
TIM_InitStruct.Autoreload = 64000000 / sample_rate - 1; //to support various sample rates
41+
TIM_InitStruct.Autoreload =
42+
SystemCoreClock / sample_rate - 1; //to support various sample rates
4243

4344
LL_TIM_Init(SAMPLE_RATE_TIMER, &TIM_InitStruct);
4445

@@ -95,7 +96,7 @@ void wav_player_dma_init(uint32_t address, size_t size) {
9596
LL_DMA_SetPeriphIncMode(DMA_INSTANCE, LL_DMA_PERIPH_NOINCREMENT);
9697
LL_DMA_SetMemoryIncMode(DMA_INSTANCE, LL_DMA_MEMORY_INCREMENT);
9798
LL_DMA_SetPeriphSize(DMA_INSTANCE, LL_DMA_PDATAALIGN_HALFWORD);
98-
LL_DMA_SetMemorySize(DMA_INSTANCE, LL_DMA_MDATAALIGN_HALFWORD);
99+
LL_DMA_SetMemorySize(DMA_INSTANCE, LL_DMA_MDATAALIGN_BYTE);
99100

100101
LL_DMA_EnableIT_TC(DMA_INSTANCE);
101102
LL_DMA_EnableIT_HT(DMA_INSTANCE);

wav_player/wav_player_view.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ void wav_player_view_set_bits(WavPlayerView* wav_view, uint16_t bit) {
174174
wav_view->view, WavPlayerViewModel * model, { model->bits_per_sample = bit; }, true);
175175
}
176176

177-
void wav_player_view_set_data(WavPlayerView* wav_view, uint16_t* data, size_t data_count) {
177+
void wav_player_view_set_data(WavPlayerView* wav_view, uint8_t* data, size_t data_count) {
178178
furi_assert(wav_view);
179179
with_view_model(
180180
wav_view->view,

wav_player/wav_player_view.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void wav_player_view_set_current(WavPlayerView* wav_view, size_t current);
6464

6565
void wav_player_view_set_play(WavPlayerView* wav_view, bool play);
6666

67-
void wav_player_view_set_data(WavPlayerView* wav_view, uint16_t* data, size_t data_count);
67+
void wav_player_view_set_data(WavPlayerView* wav_view, uint8_t* data, size_t data_count);
6868

6969
void wav_player_view_set_bits(WavPlayerView* wav_view, uint16_t bit);
7070
void wav_player_view_set_chans(WavPlayerView* wav_view, uint16_t chn);

0 commit comments

Comments
 (0)