Przeglądaj źródła

Formatted and linted per clang format.

Cody Tolene 2 lat temu
rodzic
commit
02be440d19

+ 6 - 3
src-fap/helpers/camera_suite_storage.c

@@ -47,8 +47,10 @@ void camera_suite_save_settings(void* context) {
     }
 
     // Store Settings
-    flipper_format_write_header_cstr(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_header_cstr(
+        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);
@@ -101,7 +103,8 @@ void camera_suite_read_settings(void* context) {
     }
 
     // Read settings
-    flipper_format_read_uint32(fff_file, BOILERPLATE_SETTINGS_KEY_ORIENTATION, &app->orientation, 1);
+    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);

+ 18 - 22
src-fap/views/camera_suite_view_camera.c

@@ -115,28 +115,24 @@ static void save_image(void* _model) {
         datetime.day,
         datetime.hour,
         datetime.minute,
-        datetime.second
-    );
+        datetime.second);
 
-    // Open the file for writing. If the file does not exist (it shouldn't), 
+    // Open the file for writing. If the file does not exist (it shouldn't),
     // create it.
-    bool result = storage_file_open(
-        file, 
-        furi_string_get_cstr(file_name), 
-        FSAM_WRITE, FSOM_OPEN_ALWAYS
-    );
+    bool result =
+        storage_file_open(file, furi_string_get_cstr(file_name), FSAM_WRITE, FSOM_OPEN_ALWAYS);
 
     // Free the file name after use.
     furi_string_free(file_name);
 
     // If the file was opened successfully, write the bitmap header and the
     // image data.
-    if (result){
+    if(result) {
         storage_file_write(file, bitmap_header, BITMAP_HEADER_LENGTH);
         int8_t row_buffer[ROW_BUFFER_LENGTH];
-        for (size_t i = 64; i > 0; --i) {
-            for (size_t j = 0; j < ROW_BUFFER_LENGTH; ++j){
-                row_buffer[j] = model->pixels[((i-1)*ROW_BUFFER_LENGTH) + j];
+        for(size_t i = 64; i > 0; --i) {
+            for(size_t j = 0; j < ROW_BUFFER_LENGTH; ++j) {
+                row_buffer[j] = model->pixels[((i - 1) * ROW_BUFFER_LENGTH) + j];
             }
             storage_file_write(file, row_buffer, ROW_BUFFER_LENGTH);
         }
@@ -272,7 +268,7 @@ static bool camera_suite_view_camera_input(InputEvent* event, void* context) {
                 },
                 true);
             return true;
-        }  
+        }
         case InputKeyMAX:
             break;
         }
@@ -308,15 +304,15 @@ static void camera_suite_view_camera_enter(void* context) {
     // Initialize the camera with the selected dithering option from options.
     CameraSuite* instanceContext = instance->context;
     switch(instanceContext->dither) {
-        case 0: // Floyd Steinberg
-            data[0] = '0';
-            break;
-        case 1: // Stucki
-            data[0] = '1';
-            break;
-        case 2: // Jarvis Judice Ninke
-            data[0] = '2';
-            break;
+    case 0: // Floyd Steinberg
+        data[0] = '0';
+        break;
+    case 1: // Stucki
+        data[0] = '1';
+        break;
+    case 2: // Jarvis Judice Ninke
+        data[0] = '2';
+        break;
     }
 
     // Send `data` to the ESP32-CAM

+ 4 - 7
src-fap/views/camera_suite_view_camera.h

@@ -26,13 +26,10 @@
 #define BITMAP_HEADER_LENGTH 62
 
 static const unsigned char bitmap_header[BITMAP_HEADER_LENGTH] = {
-	0x42, 0x4D, 0x3E, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00,
-	0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x00,
-	0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
-	0xFF, 0x00
-};
+    0x42, 0x4D, 0x3E, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x28, 0x00,
+    0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00};
 
 extern const Icon I_DolphinCommon_56x48;