mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 12:08:36 -07:00
Merge branch 'dev' into shutdown_idle
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <notification/notification_messages.h>
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
|
||||
#define TAG "BtSrv"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <furi.h>
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
|
||||
#include "../desktop_i.h"
|
||||
#include "desktop_view_lock_menu.h"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <gui/elements.h>
|
||||
#include <gui/icon.h>
|
||||
#include <gui/view.h>
|
||||
#include <assets_icons.h>
|
||||
#include <portmacro.h>
|
||||
|
||||
#include <desktop/desktop_settings.h>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <furi.h>
|
||||
#include <gui/view.h>
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
#include <stdint.h>
|
||||
#include <portmacro.h>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "dialogs/dialogs_message.h"
|
||||
#include "dialogs_i.h"
|
||||
#include "dialogs_api_lock.h"
|
||||
#include <assets_icons.h>
|
||||
|
||||
/****************** File browser ******************/
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ static const DolphinDeedWeight dolphin_deed_weights[] = {
|
||||
{1, DolphinAppNfc}, // DolphinDeedNfcDetectReader
|
||||
{2, DolphinAppNfc}, // DolphinDeedNfcEmulate
|
||||
{2, DolphinAppNfc}, // DolphinDeedNfcMfcAdd
|
||||
{1, DolphinAppNfc}, // DolphinDeedNfcMfulError
|
||||
{1, DolphinAppNfc}, // DolphinDeedNfcAddSave
|
||||
{1, DolphinAppNfc}, // DolphinDeedNfcAddEmulate
|
||||
|
||||
{1, DolphinAppIr}, // DolphinDeedIrSend
|
||||
{3, DolphinAppIr}, // DolphinDeedIrLearnSuccess
|
||||
|
||||
@@ -37,8 +37,8 @@ typedef enum {
|
||||
DolphinDeedNfcDetectReader,
|
||||
DolphinDeedNfcEmulate,
|
||||
DolphinDeedNfcMfcAdd,
|
||||
DolphinDeedNfcMfulError,
|
||||
DolphinDeedNfcAddSave,
|
||||
DolphinDeedNfcAddEmulate,
|
||||
|
||||
DolphinDeedIrSend,
|
||||
DolphinDeedIrLearnSuccess,
|
||||
|
||||
@@ -371,16 +371,39 @@ void canvas_set_bitmap_mode(Canvas* canvas, bool alpha) {
|
||||
void canvas_set_orientation(Canvas* canvas, CanvasOrientation orientation) {
|
||||
furi_assert(canvas);
|
||||
if(canvas->orientation != orientation) {
|
||||
canvas->orientation = orientation;
|
||||
if(canvas->orientation == CanvasOrientationHorizontal) {
|
||||
FURI_SWAP(canvas->width, canvas->height);
|
||||
switch(orientation) {
|
||||
case CanvasOrientationHorizontal:
|
||||
if(canvas->orientation == CanvasOrientationVertical ||
|
||||
canvas->orientation == CanvasOrientationVerticalFlip) {
|
||||
FURI_SWAP(canvas->width, canvas->height);
|
||||
}
|
||||
u8g2_SetDisplayRotation(&canvas->fb, U8G2_R0);
|
||||
} else if(canvas->orientation == CanvasOrientationVertical) {
|
||||
FURI_SWAP(canvas->width, canvas->height);
|
||||
break;
|
||||
case CanvasOrientationHorizontalFlip:
|
||||
if(canvas->orientation == CanvasOrientationVertical ||
|
||||
canvas->orientation == CanvasOrientationVerticalFlip) {
|
||||
FURI_SWAP(canvas->width, canvas->height);
|
||||
}
|
||||
u8g2_SetDisplayRotation(&canvas->fb, U8G2_R2);
|
||||
break;
|
||||
case CanvasOrientationVertical:
|
||||
if(canvas->orientation == CanvasOrientationHorizontal ||
|
||||
canvas->orientation == CanvasOrientationHorizontalFlip) {
|
||||
FURI_SWAP(canvas->width, canvas->height);
|
||||
};
|
||||
u8g2_SetDisplayRotation(&canvas->fb, U8G2_R3);
|
||||
} else {
|
||||
break;
|
||||
case CanvasOrientationVerticalFlip:
|
||||
if(canvas->orientation == CanvasOrientationHorizontal ||
|
||||
canvas->orientation == CanvasOrientationHorizontalFlip) {
|
||||
FURI_SWAP(canvas->width, canvas->height);
|
||||
}
|
||||
u8g2_SetDisplayRotation(&canvas->fb, U8G2_R1);
|
||||
break;
|
||||
default:
|
||||
furi_assert(0);
|
||||
}
|
||||
canvas->orientation = orientation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <gui/icon_animation.h>
|
||||
#include <assets_icons.h>
|
||||
#include <gui/icon.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -42,7 +42,9 @@ typedef enum {
|
||||
/** Canvas Orientation */
|
||||
typedef enum {
|
||||
CanvasOrientationHorizontal,
|
||||
CanvasOrientationHorizontalFlip,
|
||||
CanvasOrientationVertical,
|
||||
CanvasOrientationVerticalFlip,
|
||||
} CanvasOrientation;
|
||||
|
||||
/** Font Direction */
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "gui/canvas.h"
|
||||
#include "gui_i.h"
|
||||
#include <assets_icons.h>
|
||||
|
||||
#define TAG "GuiSrv"
|
||||
|
||||
@@ -152,7 +153,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
|
||||
}
|
||||
// Extra notification
|
||||
if(need_attention) {
|
||||
width = icon_get_width(&I_Attention_5x8);
|
||||
width = icon_get_width(&I_Hidden_window_9x8);
|
||||
// Prepare work area background
|
||||
canvas_frame_set(
|
||||
gui->canvas,
|
||||
@@ -166,7 +167,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
|
||||
// Draw Icon
|
||||
canvas_frame_set(
|
||||
gui->canvas, x, GUI_STATUS_BAR_Y + 2, width, GUI_STATUS_BAR_WORKAREA_HEIGHT);
|
||||
canvas_draw_icon(gui->canvas, 0, 0, &I_Attention_5x8);
|
||||
canvas_draw_icon(gui->canvas, 0, 0, &I_Hidden_window_9x8);
|
||||
// Recalculate next position
|
||||
left_used += (width + 2);
|
||||
x += (width + 2);
|
||||
@@ -322,7 +323,9 @@ void gui_add_view_port(Gui* gui, ViewPort* view_port, GuiLayer layer) {
|
||||
furi_check(layer < GuiLayerMAX);
|
||||
// Only fullscreen supports Vertical orientation for now
|
||||
furi_assert(
|
||||
(layer == GuiLayerFullscreen) || (view_port->orientation != ViewPortOrientationVertical));
|
||||
(layer == GuiLayerFullscreen) ||
|
||||
((view_port->orientation != ViewPortOrientationVertical) &&
|
||||
(view_port->orientation != ViewPortOrientationVerticalFlip)));
|
||||
|
||||
gui_lock(gui);
|
||||
// Verify that view port is not yet added
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <assets_icons.h>
|
||||
#include <gui/icon.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <m-array.h>
|
||||
#include <furi.h>
|
||||
#include <stdint.h>
|
||||
#include <assets_icons.h>
|
||||
|
||||
#define ITEM_FIRST_OFFSET 17
|
||||
#define ITEM_NEXT_OFFSET 4
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "byte_input.h"
|
||||
#include <gui/elements.h>
|
||||
#include <furi.h>
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
#include "byte_input.h"
|
||||
|
||||
struct ByteInput {
|
||||
View* view;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <m-array.h>
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
#include <furi.h>
|
||||
|
||||
struct Menu {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "text_input.h"
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
#include <furi.h>
|
||||
|
||||
struct TextInput {
|
||||
|
||||
@@ -25,7 +25,9 @@ extern "C" {
|
||||
|
||||
typedef enum {
|
||||
ViewOrientationHorizontal,
|
||||
ViewOrientationHorizontalFlip,
|
||||
ViewOrientationVertical,
|
||||
ViewOrientationVerticalFlip,
|
||||
} ViewOrientation;
|
||||
|
||||
/** View, anonymous type */
|
||||
|
||||
@@ -331,10 +331,16 @@ void view_dispatcher_set_current_view(ViewDispatcher* view_dispatcher, View* vie
|
||||
view_dispatcher->current_view = view;
|
||||
// Dispatch view enter event
|
||||
if(view_dispatcher->current_view) {
|
||||
if(view->orientation == ViewOrientationVertical)
|
||||
if(view->orientation == ViewOrientationVertical) {
|
||||
view_port_set_orientation(view_dispatcher->view_port, ViewPortOrientationVertical);
|
||||
else if(view->orientation == ViewOrientationHorizontal)
|
||||
} else if(view->orientation == ViewOrientationVerticalFlip) {
|
||||
view_port_set_orientation(view_dispatcher->view_port, ViewPortOrientationVerticalFlip);
|
||||
} else if(view->orientation == ViewOrientationHorizontal) {
|
||||
view_port_set_orientation(view_dispatcher->view_port, ViewPortOrientationHorizontal);
|
||||
} else if(view->orientation == ViewOrientationHorizontalFlip) {
|
||||
view_port_set_orientation(
|
||||
view_dispatcher->view_port, ViewPortOrientationHorizontalFlip);
|
||||
}
|
||||
view_enter(view_dispatcher->current_view);
|
||||
view_port_enabled_set(view_dispatcher->view_port, true);
|
||||
view_port_update(view_dispatcher->view_port);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
// TODO add mutex to view_port ops
|
||||
|
||||
static void view_port_rotate_buttons(InputEvent* event) {
|
||||
static void view_port_remap_buttons_vertical(InputEvent* event) {
|
||||
switch(event->key) {
|
||||
case InputKeyUp:
|
||||
event->key = InputKeyRight;
|
||||
@@ -26,14 +26,61 @@ static void view_port_rotate_buttons(InputEvent* event) {
|
||||
}
|
||||
}
|
||||
|
||||
static void view_port_setup_canvas_orientation(const ViewPort* view_port, Canvas* canvas) {
|
||||
if(view_port->orientation == ViewPortOrientationHorizontal) {
|
||||
canvas_set_orientation(canvas, CanvasOrientationHorizontal);
|
||||
} else if(view_port->orientation == ViewPortOrientationVertical) {
|
||||
canvas_set_orientation(canvas, CanvasOrientationVertical);
|
||||
static void view_port_remap_buttons_vertical_flip(InputEvent* event) {
|
||||
switch(event->key) {
|
||||
case InputKeyUp:
|
||||
event->key = InputKeyLeft;
|
||||
break;
|
||||
case InputKeyDown:
|
||||
event->key = InputKeyRight;
|
||||
break;
|
||||
case InputKeyRight:
|
||||
event->key = InputKeyUp;
|
||||
break;
|
||||
case InputKeyLeft:
|
||||
event->key = InputKeyDown;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void view_port_remap_buttons_horizontal_flip(InputEvent* event) {
|
||||
switch(event->key) {
|
||||
case InputKeyUp:
|
||||
event->key = InputKeyDown;
|
||||
break;
|
||||
case InputKeyDown:
|
||||
event->key = InputKeyUp;
|
||||
break;
|
||||
case InputKeyRight:
|
||||
event->key = InputKeyLeft;
|
||||
break;
|
||||
case InputKeyLeft:
|
||||
event->key = InputKeyRight;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void view_port_setup_canvas_orientation(const ViewPort* view_port, Canvas* canvas) {
|
||||
switch(view_port->orientation) {
|
||||
case ViewPortOrientationHorizontalFlip:
|
||||
canvas_set_orientation(canvas, CanvasOrientationHorizontalFlip);
|
||||
break;
|
||||
case ViewPortOrientationVertical:
|
||||
canvas_set_orientation(canvas, CanvasOrientationVertical);
|
||||
break;
|
||||
case ViewPortOrientationVerticalFlip:
|
||||
canvas_set_orientation(canvas, CanvasOrientationVerticalFlip);
|
||||
break;
|
||||
default:
|
||||
canvas_set_orientation(canvas, CanvasOrientationHorizontal);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
ViewPort* view_port_alloc() {
|
||||
ViewPort* view_port = malloc(sizeof(ViewPort));
|
||||
view_port->orientation = ViewPortOrientationHorizontal;
|
||||
@@ -122,8 +169,19 @@ void view_port_input(ViewPort* view_port, InputEvent* event) {
|
||||
furi_check(view_port->gui);
|
||||
|
||||
if(view_port->input_callback) {
|
||||
if(view_port_get_orientation(view_port) == ViewPortOrientationVertical) {
|
||||
view_port_rotate_buttons(event);
|
||||
ViewPortOrientation orientation = view_port_get_orientation(view_port);
|
||||
switch(orientation) {
|
||||
case ViewPortOrientationHorizontalFlip:
|
||||
view_port_remap_buttons_horizontal_flip(event);
|
||||
break;
|
||||
case ViewPortOrientationVertical:
|
||||
view_port_remap_buttons_vertical(event);
|
||||
break;
|
||||
case ViewPortOrientationVerticalFlip:
|
||||
view_port_remap_buttons_vertical_flip(event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
view_port->input_callback(event, view_port->input_callback_context);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ typedef struct ViewPort ViewPort;
|
||||
|
||||
typedef enum {
|
||||
ViewPortOrientationHorizontal,
|
||||
ViewPortOrientationHorizontalFlip,
|
||||
ViewPortOrientationVertical,
|
||||
ViewPortOrientationVerticalFlip,
|
||||
} ViewPortOrientation;
|
||||
|
||||
/** ViewPort Draw callback
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <stdint.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/gui.h>
|
||||
#include <assets_icons.h>
|
||||
|
||||
#include <gui/modules/popup.h>
|
||||
#include "views/power_off.h"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "power_off.h"
|
||||
#include <furi.h>
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
|
||||
struct PowerOff {
|
||||
View* view;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "power_unplug_usb.h"
|
||||
#include <furi.h>
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
|
||||
struct PowerUnplugUsb {
|
||||
View* view;
|
||||
|
||||
@@ -148,7 +148,8 @@ size_t
|
||||
rpc_session_feed(RpcSession* session, uint8_t* encoded_bytes, size_t size, TickType_t timeout) {
|
||||
furi_assert(session);
|
||||
furi_assert(encoded_bytes);
|
||||
furi_assert(size > 0);
|
||||
|
||||
if(!size) return 0;
|
||||
|
||||
size_t bytes_sent = furi_stream_buffer_send(session->stream, encoded_bytes, size, timeout);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "storage/storage_glue.h"
|
||||
#include "storages/storage_int.h"
|
||||
#include "storages/storage_ext.h"
|
||||
#include <assets_icons.h>
|
||||
|
||||
#define STORAGE_TICK 1000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user