mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 21:18:35 -07:00
Multiple Fixes
by hedger
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include <input/input.h>
|
||||
#include <notification/notification.h>
|
||||
#include <notification/notification_messages.h>
|
||||
#include <gui/canvas_i.h>
|
||||
#include "bomberduck_icons.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
3
|
||||
|
Before Width: | Height: | Size: 113 B After Width: | Height: | Size: 113 B |
|
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 116 B |
|
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 116 B |
27
applications/external/flappy_bird/flappy_bird.c
vendored
27
applications/external/flappy_bird/flappy_bird.c
vendored
@@ -3,7 +3,6 @@
|
||||
#include <flappy_bird_icons.h>
|
||||
#include <furi.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/icon_animation_i.h>
|
||||
#include <input/input.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
@@ -30,6 +29,19 @@ typedef enum {
|
||||
EventTypeKey,
|
||||
} EventType;
|
||||
|
||||
typedef enum {
|
||||
BirdState0 = 0,
|
||||
BirdState1,
|
||||
BirdState2,
|
||||
BirdStateMAX
|
||||
} BirdState;
|
||||
|
||||
const Icon* bird_states[BirdStateMAX] = {
|
||||
&I_bird_01,
|
||||
&I_bird_02,
|
||||
&I_bird_03,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
@@ -38,7 +50,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
float gravity;
|
||||
POINT point;
|
||||
IconAnimation* sprite;
|
||||
} BIRD;
|
||||
|
||||
typedef struct {
|
||||
@@ -93,7 +104,6 @@ static void flappy_game_state_init(GameState* const game_state) {
|
||||
bird.gravity = 0.0f;
|
||||
bird.point.x = 15;
|
||||
bird.point.y = 32;
|
||||
bird.sprite = icon_animation_alloc(&A_bird);
|
||||
|
||||
game_state->debug = DEBUG;
|
||||
game_state->bird = bird;
|
||||
@@ -106,7 +116,6 @@ static void flappy_game_state_init(GameState* const game_state) {
|
||||
}
|
||||
|
||||
static void flappy_game_state_free(GameState* const game_state) {
|
||||
icon_animation_free(game_state->bird.sprite);
|
||||
free(game_state);
|
||||
}
|
||||
|
||||
@@ -224,14 +233,14 @@ static void flappy_game_render_callback(Canvas* const canvas, void* ctx) {
|
||||
}
|
||||
|
||||
// Switch animation
|
||||
game_state->bird.sprite->frame = 1;
|
||||
BirdState bird_state = BirdState1;
|
||||
if(game_state->bird.gravity < -0.5)
|
||||
game_state->bird.sprite->frame = 0;
|
||||
bird_state = BirdState0;
|
||||
else if(game_state->bird.gravity > 0.5)
|
||||
game_state->bird.sprite->frame = 2;
|
||||
bird_state = BirdState2;
|
||||
|
||||
canvas_draw_icon_animation(
|
||||
canvas, game_state->bird.point.x, game_state->bird.point.y, game_state->bird.sprite);
|
||||
canvas_draw_icon(
|
||||
canvas, game_state->bird.point.x, game_state->bird.point.y, bird_states[bird_state]);
|
||||
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
char buffer[12];
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <input/input.h>
|
||||
#include <notification/notification.h>
|
||||
#include <notification/notification_messages.h>
|
||||
#include <gui/canvas_i.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
#define Y_FIELD_SIZE 6
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <notification/notification_messages.h>
|
||||
#include <dialogs/dialogs.h>
|
||||
#include <m-string.h>
|
||||
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
|
||||
65
applications/external/swd_probe/swd_probe_app.c
vendored
65
applications/external/swd_probe/swd_probe_app.c
vendored
@@ -679,7 +679,7 @@ static bool swd_apscan_test(AppFSM* const ctx, uint32_t ap) {
|
||||
static void swd_script_log(ScriptContext* ctx, FuriLogLevel level, const char* format, ...) {
|
||||
bool commandline = false;
|
||||
ScriptContext* cur = ctx;
|
||||
char buffer[256];
|
||||
FuriString* buffer = furi_string_alloc();
|
||||
va_list argp;
|
||||
va_start(argp, format);
|
||||
|
||||
@@ -704,17 +704,19 @@ static void swd_script_log(ScriptContext* ctx, FuriLogLevel level, const char* f
|
||||
break;
|
||||
}
|
||||
|
||||
strcpy(buffer, prefix);
|
||||
size_t pos = strlen(buffer);
|
||||
vsnprintf(&buffer[pos], sizeof(buffer) - pos - 2, format, argp);
|
||||
strcat(buffer, "\n");
|
||||
if(!usb_uart_tx_data(ctx->app->uart, (uint8_t*)buffer, strlen(buffer))) {
|
||||
furi_string_cat_str(buffer, prefix);
|
||||
furi_string_cat_printf(buffer, format, argp);
|
||||
furi_string_cat_str(buffer, "\n");
|
||||
|
||||
if(!usb_uart_tx_data(
|
||||
ctx->app->uart, (uint8_t*)furi_string_get_cstr(buffer), furi_string_size(buffer))) {
|
||||
DBGS("Sending via USB failed");
|
||||
}
|
||||
} else {
|
||||
LOG(buffer);
|
||||
LOG(furi_string_get_cstr(buffer));
|
||||
}
|
||||
va_end(argp);
|
||||
furi_string_free(buffer);
|
||||
}
|
||||
|
||||
/* read characters until newline was read */
|
||||
@@ -939,41 +941,44 @@ static bool swd_scriptfunc_goto(ScriptContext* ctx) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#include <toolbox/path.h>
|
||||
|
||||
static bool swd_scriptfunc_call(ScriptContext* ctx) {
|
||||
DBGS("call");
|
||||
|
||||
swd_script_skip_whitespace(ctx);
|
||||
|
||||
/* fetch previous file directory */
|
||||
char filename[MAX_FILE_LENGTH];
|
||||
strncpy(filename, ctx->filename, sizeof(filename));
|
||||
char* path = strrchr(filename, '/');
|
||||
path[1] = '\000';
|
||||
FuriString* filepath = furi_string_alloc();
|
||||
path_extract_dirname(ctx->filename, filepath);
|
||||
// strncpy(filename, ctx->filename, sizeof(filename));
|
||||
|
||||
/* append filename */
|
||||
if(!swd_script_get_string(ctx, &path[1], sizeof(filename) - strlen(path))) {
|
||||
swd_script_log(ctx, FuriLogLevelError, "failed to parse filename");
|
||||
return false;
|
||||
}
|
||||
char filename[MAX_FILE_LENGTH] = {};
|
||||
bool success = false;
|
||||
do {
|
||||
/* append filename */
|
||||
if(!swd_script_get_string(ctx, filename, sizeof(filename))) {
|
||||
swd_script_log(ctx, FuriLogLevelError, "failed to parse filename");
|
||||
break;
|
||||
}
|
||||
|
||||
swd_script_seek_newline(ctx);
|
||||
swd_script_seek_newline(ctx);
|
||||
/* append extension */
|
||||
furi_string_cat_str(filepath, ".swd");
|
||||
|
||||
/* append extension */
|
||||
if(strlen(filename) + 5 >= sizeof(filename)) {
|
||||
swd_script_log(ctx, FuriLogLevelError, "name too long");
|
||||
return false;
|
||||
}
|
||||
bool ret = swd_execute_script(ctx->app, furi_string_get_cstr(filepath));
|
||||
|
||||
strcat(filename, ".swd");
|
||||
if(!ret) {
|
||||
swd_script_log(
|
||||
ctx, FuriLogLevelError, "failed to exec '%s'", furi_string_get_cstr(filepath));
|
||||
break;
|
||||
}
|
||||
|
||||
bool ret = swd_execute_script(ctx->app, filename);
|
||||
success = true;
|
||||
} while(false);
|
||||
furi_string_free(filepath);
|
||||
|
||||
if(!ret) {
|
||||
swd_script_log(ctx, FuriLogLevelError, "failed to exec '%s'", filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return success;
|
||||
}
|
||||
|
||||
static bool swd_scriptfunc_status(ScriptContext* ctx) {
|
||||
|
||||
Reference in New Issue
Block a user