Merge branch 'dev' into dev
@@ -8,8 +8,8 @@ App(
|
||||
stack_size=8 * 1024,
|
||||
order=50,
|
||||
fap_icon="appicon.png",
|
||||
fap_icon_assets="assets", # Image assets to compile for this application
|
||||
fap_category="Games",
|
||||
fap_icon_assets="assets", # Image assets to compile for this application
|
||||
fap_description="An implementation of the classic arcade game Asteroids",
|
||||
fap_author="antirez, SimplyMinimal",
|
||||
fap_weburl="https://github.com/SimplyMinimal/FlipperZero-Asteroids",
|
||||
|
||||
BIN
applications/external/bpmtapper/img/screenshot.png
vendored
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
applications/external/brainfuck/icons/Text_10x10.png
vendored
|
Before Width: | Height: | Size: 158 B |
@@ -79,8 +79,8 @@ typedef struct {
|
||||
|
||||
void* view_dispatcher;
|
||||
void* primary_menu;
|
||||
void* plugins_menu;
|
||||
void* debug_menu;
|
||||
// void* plugins_menu;
|
||||
// void* debug_menu;
|
||||
void* settings_menu;
|
||||
|
||||
volatile uint8_t lock_count;
|
||||
|
||||
BIN
applications/external/doom/assets/screenshot1.png
vendored
|
Before Width: | Height: | Size: 1.5 KiB |
BIN
applications/external/doom/assets/screenshot2.png
vendored
|
Before Width: | Height: | Size: 1.7 KiB |
BIN
applications/external/doom/assets/screenshot3.png
vendored
|
Before Width: | Height: | Size: 1.6 KiB |
59
applications/external/geiger/flipper_geiger.c
vendored
@@ -39,33 +39,53 @@ typedef struct {
|
||||
static void draw_callback(Canvas* canvas, void* ctx) {
|
||||
furi_assert(ctx);
|
||||
|
||||
mutexStruct displayStruct;
|
||||
mutexStruct* geigerMutex = ctx;
|
||||
furi_mutex_acquire(geigerMutex->mutex, FuriWaitForever);
|
||||
memcpy(&displayStruct, geigerMutex, sizeof(mutexStruct));
|
||||
furi_mutex_release(geigerMutex->mutex);
|
||||
mutexStruct* mutexVal = ctx;
|
||||
mutexStruct mutexDraw;
|
||||
furi_mutex_acquire(mutexVal->mutex, FuriWaitForever);
|
||||
memcpy(&mutexDraw, mutexVal, sizeof(mutexStruct));
|
||||
furi_mutex_release(mutexVal->mutex);
|
||||
|
||||
char buffer[32];
|
||||
if(displayStruct.data == 0)
|
||||
snprintf(
|
||||
buffer, sizeof(buffer), "%ld cps - %ld cpm", displayStruct.cps, displayStruct.cpm);
|
||||
else if(displayStruct.data == 1)
|
||||
if(mutexDraw.data == 0)
|
||||
snprintf(buffer, sizeof(buffer), "%ld cps - %ld cpm", mutexDraw.cps, mutexDraw.cpm);
|
||||
else if(mutexDraw.data == 1)
|
||||
snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"%ld cps - %.2f uSv/h",
|
||||
displayStruct.cps,
|
||||
((double)displayStruct.cpm * (double)CONVERSION_FACTOR));
|
||||
else
|
||||
mutexDraw.cps,
|
||||
((double)mutexDraw.cpm * (double)CONVERSION_FACTOR));
|
||||
else if(mutexDraw.data == 2)
|
||||
snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"%ld cps - %.2f mSv/y",
|
||||
displayStruct.cps,
|
||||
(((double)displayStruct.cpm * (double)CONVERSION_FACTOR)) * (double)8.76);
|
||||
mutexDraw.cps,
|
||||
(((double)mutexDraw.cpm * (double)CONVERSION_FACTOR)) * (double)8.76);
|
||||
else if(mutexDraw.data == 3)
|
||||
snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"%ld cps - %.4f Rad/h",
|
||||
mutexDraw.cps,
|
||||
((double)mutexDraw.cpm * (double)CONVERSION_FACTOR) / (double)10000);
|
||||
else if(mutexDraw.data == 4)
|
||||
snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"%ld cps - %.2f mR/h",
|
||||
mutexDraw.cps,
|
||||
((double)mutexDraw.cpm * (double)CONVERSION_FACTOR) / (double)10);
|
||||
else
|
||||
snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"%ld cps - %.2f uR/h",
|
||||
mutexDraw.cps,
|
||||
((double)mutexDraw.cpm * (double)CONVERSION_FACTOR) * (double)100);
|
||||
|
||||
for(int i = 0; i < SCREEN_SIZE_X; i += 2) {
|
||||
float Y = SCREEN_SIZE_Y - (displayStruct.line[i / 2] * displayStruct.coef);
|
||||
float Y = SCREEN_SIZE_Y - (mutexDraw.line[i / 2] * mutexDraw.coef);
|
||||
|
||||
canvas_draw_line(canvas, i, Y, i, SCREEN_SIZE_Y);
|
||||
canvas_draw_line(canvas, i + 1, Y, i + 1, SCREEN_SIZE_Y);
|
||||
@@ -103,8 +123,7 @@ static void gpiocallback(void* ctx) {
|
||||
furi_message_queue_put(queue, &event, 0);
|
||||
}
|
||||
|
||||
int32_t flipper_geiger_app(void* p) {
|
||||
UNUSED(p);
|
||||
int32_t flipper_geiger_app() {
|
||||
EventApp event;
|
||||
FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(EventApp));
|
||||
|
||||
@@ -127,7 +146,7 @@ int32_t flipper_geiger_app(void* p) {
|
||||
}
|
||||
|
||||
ViewPort* view_port = view_port_alloc();
|
||||
view_port_draw_callback_set(view_port, draw_callback, &mutexVal);
|
||||
view_port_draw_callback_set(view_port, draw_callback, &mutexVal.mutex);
|
||||
view_port_input_callback_set(view_port, input_callback, event_queue);
|
||||
|
||||
furi_hal_gpio_add_int_callback(&gpio_ext_pa7, gpiocallback, event_queue);
|
||||
@@ -167,7 +186,7 @@ int32_t flipper_geiger_app(void* p) {
|
||||
if(mutexVal.data != 0)
|
||||
mutexVal.data--;
|
||||
else
|
||||
mutexVal.data = 2;
|
||||
mutexVal.data = 5;
|
||||
|
||||
screenRefresh = 1;
|
||||
furi_mutex_release(mutexVal.mutex);
|
||||
@@ -175,7 +194,7 @@ int32_t flipper_geiger_app(void* p) {
|
||||
event.input.type == InputTypeShort)) {
|
||||
furi_mutex_acquire(mutexVal.mutex, FuriWaitForever);
|
||||
|
||||
if(mutexVal.data != 2)
|
||||
if(mutexVal.data != 5)
|
||||
mutexVal.data++;
|
||||
else
|
||||
mutexVal.data = 0;
|
||||
|
||||
|
Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 135 B |
|
Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 135 B |
@@ -82,7 +82,7 @@ static void gpio_usb_uart_draw_callback(Canvas* canvas, void* _model) {
|
||||
if(model->rx_active)
|
||||
canvas_draw_icon_ex(canvas, 48, 34, &I_ArrowUpFilled_14x15, IconRotation180);
|
||||
else
|
||||
canvas_draw_icon_ex(canvas, 48, 34, &I_ArrowUpFilled_14x15, IconRotation180);
|
||||
canvas_draw_icon_ex(canvas, 48, 34, &I_ArrowUpEmpty_14x15, IconRotation180);
|
||||
}
|
||||
|
||||
static bool gpio_usb_uart_input_callback(InputEvent* event, void* context) {
|
||||
@@ -38,6 +38,11 @@ void save_settings_file(FlipperFormat* file, Settings* settings) {
|
||||
Settings* load_settings() {
|
||||
Settings* settings = malloc(sizeof(Settings));
|
||||
|
||||
settings->save_ssid = "";
|
||||
settings->save_password = "";
|
||||
settings->save_key = "";
|
||||
settings->save_event = "";
|
||||
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
|
||||
@@ -53,29 +58,14 @@ Settings* load_settings() {
|
||||
text_event_value = furi_string_alloc();
|
||||
|
||||
if(storage_common_stat(storage, CONFIG_FILE_PATH, NULL) != FSE_OK) {
|
||||
if(!flipper_format_file_open_new(file, CONFIG_FILE_PATH)) {
|
||||
flipper_format_file_close(file);
|
||||
} else {
|
||||
settings->save_ssid = malloc(1);
|
||||
settings->save_password = malloc(1);
|
||||
settings->save_key = malloc(1);
|
||||
settings->save_event = malloc(1);
|
||||
|
||||
settings->save_ssid[0] = '\0';
|
||||
settings->save_password[0] = '\0';
|
||||
settings->save_key[0] = '\0';
|
||||
settings->save_event[0] = '\0';
|
||||
|
||||
if(flipper_format_file_open_new(file, CONFIG_FILE_PATH)) {
|
||||
save_settings_file(file, settings);
|
||||
flipper_format_file_close(file);
|
||||
}
|
||||
flipper_format_file_close(file);
|
||||
} else {
|
||||
if(!flipper_format_file_open_existing(file, CONFIG_FILE_PATH)) {
|
||||
flipper_format_file_close(file);
|
||||
} else {
|
||||
if(flipper_format_file_open_existing(file, CONFIG_FILE_PATH)) {
|
||||
uint32_t value;
|
||||
if(!flipper_format_read_header(file, string_value, &value)) {
|
||||
} else {
|
||||
if(flipper_format_read_header(file, string_value, &value)) {
|
||||
if(flipper_format_read_string(file, CONF_SSID, text_ssid_value)) {
|
||||
settings->save_ssid = malloc(furi_string_size(text_ssid_value) + 1);
|
||||
strcpy(settings->save_ssid, furi_string_get_cstr(text_ssid_value));
|
||||
@@ -93,8 +83,8 @@ Settings* load_settings() {
|
||||
strcpy(settings->save_event, furi_string_get_cstr(text_event_value));
|
||||
}
|
||||
}
|
||||
flipper_format_file_close(file);
|
||||
}
|
||||
flipper_format_file_close(file);
|
||||
}
|
||||
|
||||
furi_string_free(text_ssid_value);
|
||||
|
||||
BIN
applications/external/metronome/img/screenshot.png
vendored
|
Before Width: | Height: | Size: 1.9 KiB |
BIN
applications/external/minesweeper/img/screenshot.png
vendored
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 136 B |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
@@ -78,6 +78,7 @@ void flipp_pomodoro_app_free(FlippPomodoroApp* app) {
|
||||
view_dispatcher_free(app->view_dispatcher);
|
||||
scene_manager_free(app->scene_manager);
|
||||
flipp_pomodoro_view_timer_free(app->timer_view);
|
||||
flipp_pomodoro__destroy(app->state);
|
||||
free(app);
|
||||
furi_record_close(RECORD_GUI);
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
|
||||
@@ -55,6 +55,11 @@ char* flipp_pomodoro__next_stage_label(FlippPomodoroState* state) {
|
||||
return next_stage_label[flipp_pomodoro__stage_by_index(state->current_stage_index + 1)];
|
||||
}
|
||||
|
||||
void flipp_pomodoro__destroy(FlippPomodoroState* state) {
|
||||
furi_assert(state);
|
||||
free(state);
|
||||
};
|
||||
|
||||
uint32_t flipp_pomodoro__current_stage_total_duration(FlippPomodoroState* state) {
|
||||
const int32_t stage_duration_seconds_map[] = {
|
||||
[FlippPomodoroStageFocus] = 25 * TIME_SECONDS_IN_MINUTE,
|
||||
|
||||
30
applications/external/pong/flipper_pong.c
vendored
@@ -15,8 +15,7 @@
|
||||
|
||||
#define PAD_SIZE_X 3
|
||||
#define PAD_SIZE_Y 8
|
||||
#define PLAYER1_PAD_SPEED 4
|
||||
|
||||
#define PLAYER1_PAD_SPEED 2
|
||||
#define PLAYER2_PAD_SPEED 2
|
||||
#define BALL_SIZE 4
|
||||
|
||||
@@ -39,29 +38,22 @@ typedef struct Players {
|
||||
|
||||
static void draw_callback(Canvas* canvas, void* ctx) {
|
||||
furi_assert(ctx);
|
||||
Players* playersMutex = ctx;
|
||||
furi_mutex_acquire(playersMutex->mutex, FuriWaitForever);
|
||||
Players* players = ctx;
|
||||
furi_mutex_acquire(players->mutex, FuriWaitForever);
|
||||
|
||||
canvas_draw_frame(canvas, 0, 0, 128, 64);
|
||||
canvas_draw_box(
|
||||
canvas, playersMutex->player1_X, playersMutex->player1_Y, PAD_SIZE_X, PAD_SIZE_Y);
|
||||
canvas_draw_box(
|
||||
canvas, playersMutex->player2_X, playersMutex->player2_Y, PAD_SIZE_X, PAD_SIZE_Y);
|
||||
canvas_draw_box(canvas, playersMutex->ball_X, playersMutex->ball_Y, BALL_SIZE, BALL_SIZE);
|
||||
canvas_draw_box(canvas, players->player1_X, players->player1_Y, PAD_SIZE_X, PAD_SIZE_Y);
|
||||
canvas_draw_box(canvas, players->player2_X, players->player2_Y, PAD_SIZE_X, PAD_SIZE_Y);
|
||||
canvas_draw_box(canvas, players->ball_X, players->ball_Y, BALL_SIZE, BALL_SIZE);
|
||||
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_set_font_direction(canvas, CanvasDirectionBottomToTop);
|
||||
char buffer[16];
|
||||
snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"%u - %u",
|
||||
playersMutex->player1_score,
|
||||
playersMutex->player2_score);
|
||||
snprintf(buffer, sizeof(buffer), "%u - %u", players->player1_score, players->player2_score);
|
||||
canvas_draw_str_aligned(
|
||||
canvas, SCREEN_SIZE_X / 2 + 15, SCREEN_SIZE_Y / 2 + 2, AlignCenter, AlignTop, buffer);
|
||||
|
||||
furi_mutex_release(playersMutex->mutex);
|
||||
furi_mutex_release(players->mutex);
|
||||
}
|
||||
|
||||
static void input_callback(InputEvent* input_event, void* ctx) {
|
||||
@@ -101,8 +93,7 @@ uint8_t changeDirection() {
|
||||
return randomuint8[0];
|
||||
}
|
||||
|
||||
int32_t flipper_pong_app(void* p) {
|
||||
UNUSED(p);
|
||||
int32_t flipper_pong_app() {
|
||||
EventApp event;
|
||||
FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(EventApp));
|
||||
|
||||
@@ -129,7 +120,7 @@ int32_t flipper_pong_app(void* p) {
|
||||
}
|
||||
|
||||
ViewPort* view_port = view_port_alloc();
|
||||
view_port_draw_callback_set(view_port, draw_callback, &players);
|
||||
view_port_draw_callback_set(view_port, draw_callback, &players.mutex);
|
||||
view_port_input_callback_set(view_port, input_callback, event_queue);
|
||||
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
@@ -152,7 +143,6 @@ int32_t flipper_pong_app(void* p) {
|
||||
if(event.type == EventTypeInput) {
|
||||
if(event.input.key == InputKeyBack) {
|
||||
furi_mutex_release(players.mutex);
|
||||
notification_message(notification, &sequence_set_only_green_255);
|
||||
break;
|
||||
} else if(event.input.key == InputKeyUp) {
|
||||
if(players.player1_Y >= 1 + PLAYER1_PAD_SPEED)
|
||||
|
||||
22
applications/external/rc2014_coleco/coleco.c
vendored
@@ -40,15 +40,14 @@ typedef struct {
|
||||
} PluginEvent;
|
||||
|
||||
typedef struct {
|
||||
FuriMutex* mutex;
|
||||
bool dpad;
|
||||
int row;
|
||||
int column;
|
||||
FuriMutex* mutex;
|
||||
} Coleco;
|
||||
|
||||
static void render_callback(Canvas* const canvas, void* context) {
|
||||
furi_assert(context);
|
||||
Coleco* coleco = context;
|
||||
Coleco* coleco = (Coleco*)context;
|
||||
furi_mutex_acquire(coleco->mutex, FuriWaitForever);
|
||||
|
||||
if(coleco->dpad) {
|
||||
@@ -175,12 +174,20 @@ static Coleco* coleco_alloc() {
|
||||
coleco->row = 0;
|
||||
coleco->column = 1;
|
||||
|
||||
coleco->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
|
||||
if(!coleco->mutex) {
|
||||
FURI_LOG_E("Coleco", "cannot create mutex\r\n");
|
||||
free(coleco);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return coleco;
|
||||
}
|
||||
|
||||
static void coleco_free(Coleco* coleco) {
|
||||
furi_assert(coleco);
|
||||
|
||||
furi_mutex_free(coleco->mutex);
|
||||
free(coleco);
|
||||
}
|
||||
|
||||
@@ -190,11 +197,7 @@ int32_t coleco_app(void* p) {
|
||||
FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(PluginEvent));
|
||||
|
||||
Coleco* coleco = coleco_alloc();
|
||||
|
||||
coleco->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
|
||||
if(!coleco->mutex) {
|
||||
FURI_LOG_E("Coleco", "cannot create mutex\r\n");
|
||||
coleco_free(coleco);
|
||||
if(coleco == NULL) {
|
||||
return 255;
|
||||
}
|
||||
|
||||
@@ -346,6 +349,8 @@ int32_t coleco_app(void* p) {
|
||||
|
||||
view_port_update(view_port);
|
||||
}
|
||||
} else {
|
||||
FURI_LOG_D("Coleco", "FuriMessageQueue: event timeout");
|
||||
}
|
||||
|
||||
furi_mutex_release(coleco->mutex);
|
||||
@@ -358,7 +363,6 @@ int32_t coleco_app(void* p) {
|
||||
furi_record_close("gui");
|
||||
view_port_free(view_port);
|
||||
furi_message_queue_free(event_queue);
|
||||
furi_mutex_free(coleco->mutex);
|
||||
coleco_free(coleco);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include "scrambler.h"
|
||||
#include "furi_hal_random.h"
|
||||
|
||||
int scrambleStarted = 0;
|
||||
bool scrambleStarted = false;
|
||||
char scramble_str[100] = {0};
|
||||
char scramble_start[100] = {0};
|
||||
char scramble_end[100] = {0};
|
||||
int notifications_enabled = 0;
|
||||
bool notifications_enabled = false;
|
||||
|
||||
static void success_vibration() {
|
||||
furi_hal_vibro_on(false);
|
||||
@@ -22,12 +22,12 @@ static void success_vibration() {
|
||||
return;
|
||||
}
|
||||
void split_array(char original[], int size, char first[], char second[]) {
|
||||
int mid = size / 2;
|
||||
int32_t mid = size / 2;
|
||||
if(size % 2 != 0) {
|
||||
mid++;
|
||||
}
|
||||
int first_index = 0, second_index = 0;
|
||||
for(int i = 0; i < size; i++) {
|
||||
int32_t first_index = 0, second_index = 0;
|
||||
for(int32_t i = 0; i < size; i++) {
|
||||
if(i < mid) {
|
||||
first[first_index++] = original[i];
|
||||
} else {
|
||||
@@ -40,23 +40,17 @@ void split_array(char original[], int size, char first[], char second[]) {
|
||||
first[first_index] = '\0';
|
||||
second[second_index] = '\0';
|
||||
}
|
||||
void genScramble() {
|
||||
scrambleReplace();
|
||||
strcpy(scramble_str, printData());
|
||||
split_array(scramble_str, strlen(scramble_str), scramble_start, scramble_end);
|
||||
}
|
||||
|
||||
static void draw_callback(Canvas* canvas, void* ctx) {
|
||||
UNUSED(ctx);
|
||||
canvas_clear(canvas);
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_draw_str(canvas, 4, 13, "Rubik's Cube Scrambler");
|
||||
|
||||
if(scrambleStarted) {
|
||||
genScramble();
|
||||
scrambleReplace();
|
||||
strcpy(scramble_str, printData());
|
||||
if(notifications_enabled) {
|
||||
success_vibration();
|
||||
}
|
||||
split_array(scramble_str, strlen(scramble_str), scramble_start, scramble_end);
|
||||
scrambleStarted = 0;
|
||||
}
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_draw_str_aligned(canvas, 64, 28, AlignCenter, AlignCenter, scramble_start);
|
||||
canvas_draw_str_aligned(canvas, 64, 38, AlignCenter, AlignCenter, scramble_end);
|
||||
@@ -90,13 +84,16 @@ int32_t rubiks_cube_scrambler_main(void* p) {
|
||||
furi_check(furi_message_queue_get(event_queue, &event, FuriWaitForever) == FuriStatusOk);
|
||||
|
||||
if(event.key == InputKeyOk && event.type == InputTypeShort) {
|
||||
scrambleStarted = 1;
|
||||
genScramble();
|
||||
if(notifications_enabled) {
|
||||
success_vibration();
|
||||
}
|
||||
}
|
||||
if(event.key == InputKeyLeft && event.type == InputTypeShort) {
|
||||
if(notifications_enabled) {
|
||||
notifications_enabled = 0;
|
||||
notifications_enabled = false;
|
||||
} else {
|
||||
notifications_enabled = 1;
|
||||
notifications_enabled = true;
|
||||
success_vibration();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,66 +12,37 @@ Authors: Tanish Bhongade and RaZe
|
||||
|
||||
// 6 moves along with direction
|
||||
char moves[6] = {'R', 'U', 'F', 'B', 'L', 'D'};
|
||||
char dir[4] = {' ', '\'', '2'};
|
||||
const int SLEN = 20;
|
||||
char dir[4] = {'\'', '2'};
|
||||
const int32_t SLEN = 20;
|
||||
#define RESULT_SIZE 100
|
||||
// Structure which holds main scramble
|
||||
|
||||
struct GetScramble {
|
||||
char mainScramble[25][3];
|
||||
};
|
||||
struct GetScramble a; // Its object
|
||||
|
||||
// Function prototypes to avoid bugs
|
||||
void scrambleReplace();
|
||||
void genScramble();
|
||||
void valid();
|
||||
int getRand(int upr, int lwr);
|
||||
char* printData();
|
||||
void writeToFile();
|
||||
|
||||
// Main function
|
||||
/* int main(){
|
||||
genScramble ();//Calling genScramble
|
||||
scrambleReplace();//Calling scrambleReplace
|
||||
valid();//Calling valid to validate the scramble
|
||||
printData ();//Printing the final scramble
|
||||
//writeToFile();//If you want to write to a file, please uncomment this
|
||||
|
||||
return 0;
|
||||
} */
|
||||
|
||||
void genScramble() {
|
||||
// Stage 1
|
||||
for(int i = 0; i < SLEN; i++) {
|
||||
strcpy(a.mainScramble[i], "00");
|
||||
}
|
||||
// This makes array like this 00 00 00.......
|
||||
}
|
||||
struct GetScramble a;
|
||||
|
||||
void scrambleReplace() {
|
||||
// Stage 2
|
||||
// Actual process begins here
|
||||
|
||||
// Initialize the mainScramble array with all the possible moves
|
||||
for(int i = 0; i < SLEN; i++) {
|
||||
for(int32_t i = 0; i < SLEN; i++) {
|
||||
a.mainScramble[i][0] = moves[furi_hal_random_get() % 6];
|
||||
a.mainScramble[i][1] = dir[furi_hal_random_get() % 3];
|
||||
}
|
||||
|
||||
// Perform the Fisher-Yates shuffle
|
||||
for(int i = 6 - 1; i > 0; i--) {
|
||||
int j = rand() % (i + 1);
|
||||
/* // Perform the Fisher-Yates shuffle
|
||||
for (int32_t i = 6 - 1; i > 0; i--)
|
||||
{
|
||||
int32_t j = rand() % (i + 1);
|
||||
char temp[3];
|
||||
strcpy(temp, a.mainScramble[i]);
|
||||
strcpy(a.mainScramble[i], a.mainScramble[j]);
|
||||
strcpy(a.mainScramble[j], temp);
|
||||
}
|
||||
} */
|
||||
|
||||
// Select the first 10 elements as the scramble, using only the first three elements of the dir array
|
||||
for(int i = 0; i < SLEN; i++) {
|
||||
// Select the first 10 elements as the scramble, using only the first two elements of the dir array
|
||||
for(int32_t i = 0; i < SLEN; i++) {
|
||||
a.mainScramble[i][1] = dir[furi_hal_random_get() % 3];
|
||||
}
|
||||
for(int i = 1; i < SLEN; i++) {
|
||||
for(int32_t i = 1; i < SLEN; i++) {
|
||||
while(a.mainScramble[i][0] == a.mainScramble[i - 2][0] ||
|
||||
a.mainScramble[i][0] == a.mainScramble[i - 1][0]) {
|
||||
a.mainScramble[i][0] = moves[furi_hal_random_get() % 5];
|
||||
@@ -79,24 +50,11 @@ void scrambleReplace() {
|
||||
}
|
||||
}
|
||||
|
||||
// Let this function be here for now till I find out what is causing the extra space bug in the scrambles
|
||||
void remove_double_spaces(char* str) {
|
||||
int i, j;
|
||||
int len = strlen(str);
|
||||
for(i = 0, j = 0; i < len; i++, j++) {
|
||||
if(str[i] == ' ' && str[i + 1] == ' ') {
|
||||
i++;
|
||||
}
|
||||
str[j] = str[i];
|
||||
}
|
||||
str[j] = '\0';
|
||||
}
|
||||
char* printData() {
|
||||
static char result[RESULT_SIZE];
|
||||
int offset = 0;
|
||||
for(int loop = 0; loop < SLEN; loop++) {
|
||||
int32_t offset = 0;
|
||||
for(int32_t loop = 0; loop < SLEN; loop++) {
|
||||
offset += snprintf(result + offset, RESULT_SIZE - offset, "%s ", a.mainScramble[loop]);
|
||||
}
|
||||
remove_double_spaces(result);
|
||||
return result;
|
||||
}
|
||||
@@ -1,3 +1,2 @@
|
||||
void scrambleReplace();
|
||||
void genScramble();
|
||||
char* printData();
|
||||
|
||||
BIN
applications/external/timelapse/icons/ButtonDownHollow_7x4.png
vendored
Normal file
|
After Width: | Height: | Size: 173 B |
BIN
applications/external/timelapse/icons/ButtonLeftHollow_4x7.png
vendored
Normal file
|
After Width: | Height: | Size: 149 B |
BIN
applications/external/timelapse/icons/ButtonRightHollow_4x7.png
vendored
Normal file
|
After Width: | Height: | Size: 147 B |
BIN
applications/external/timelapse/icons/ButtonUpHollow_7x4.png
vendored
Normal file
|
After Width: | Height: | Size: 143 B |
32
applications/external/timelapse/zeitraffer.c
vendored
@@ -69,16 +69,18 @@ static void draw_callback(Canvas* canvas, void* ctx) {
|
||||
canvas_draw_str(canvas, 13, 55, "AUTO");
|
||||
}
|
||||
|
||||
//canvas_draw_icon(canvas, 90, 17, &I_ButtonUp_7x4);
|
||||
//canvas_draw_icon(canvas, 100, 17, &I_ButtonDown_7x4);
|
||||
//canvas_draw_icon(canvas, 27, 17, &I_ButtonLeftSmall_3x5);
|
||||
//canvas_draw_icon(canvas, 37, 17, &I_ButtonRightSmall_3x5);
|
||||
//canvas_draw_icon(canvas, 3, 48, &I_Pin_star_7x7);
|
||||
if(Work) {
|
||||
canvas_draw_icon(canvas, 85, 41, &I_ButtonUpHollow_7x4);
|
||||
canvas_draw_icon(canvas, 85, 57, &I_ButtonDownHollow_7x4);
|
||||
canvas_draw_icon(canvas, 59, 48, &I_ButtonLeftHollow_4x7);
|
||||
canvas_draw_icon(canvas, 72, 48, &I_ButtonRightHollow_4x7);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 85, 41, &I_ButtonUp_7x4);
|
||||
canvas_draw_icon(canvas, 85, 57, &I_ButtonDown_7x4);
|
||||
canvas_draw_icon(canvas, 59, 48, &I_ButtonLeft_4x7);
|
||||
canvas_draw_icon(canvas, 72, 48, &I_ButtonRight_4x7);
|
||||
}
|
||||
|
||||
canvas_draw_icon(canvas, 85, 41, &I_ButtonUp_7x4);
|
||||
canvas_draw_icon(canvas, 85, 57, &I_ButtonDown_7x4);
|
||||
canvas_draw_icon(canvas, 59, 48, &I_ButtonLeft_4x7);
|
||||
canvas_draw_icon(canvas, 72, 48, &I_ButtonRight_4x7);
|
||||
canvas_draw_icon(canvas, 3, 48, &I_Pin_star_7x7);
|
||||
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
@@ -87,8 +89,8 @@ static void draw_callback(Canvas* canvas, void* ctx) {
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_draw_str(canvas, 85, 55, "S");
|
||||
|
||||
canvas_draw_icon(canvas, 59, 48, &I_ButtonLeft_4x7);
|
||||
canvas_draw_icon(canvas, 72, 48, &I_ButtonRight_4x7);
|
||||
//canvas_draw_icon(canvas, 59, 48, &I_ButtonLeft_4x7);
|
||||
//canvas_draw_icon(canvas, 72, 48, &I_ButtonRight_4x7);
|
||||
|
||||
if(Work) {
|
||||
canvas_draw_icon(canvas, 106, 46, &I_loading_10px);
|
||||
@@ -151,6 +153,10 @@ int32_t zeitraffer_app(void* p) {
|
||||
FlipperFormat* load = flipper_format_file_alloc(storage);
|
||||
|
||||
do {
|
||||
if(!storage_simply_mkdir(storage, CONFIG_FILE_DIRECTORY_PATH)) {
|
||||
notification_message(notifications, &sequence_error);
|
||||
break;
|
||||
}
|
||||
if(!flipper_format_file_open_existing(load, CONFIG_FILE_PATH)) {
|
||||
notification_message(notifications, &sequence_error);
|
||||
break;
|
||||
@@ -247,6 +253,8 @@ int32_t zeitraffer_app(void* p) {
|
||||
|
||||
if(WorkTime == 0) WorkTime = Delay;
|
||||
|
||||
if(Count == 1) WorkTime = Time;
|
||||
|
||||
if(Count == 0) {
|
||||
InfiniteShot = true;
|
||||
WorkCount = 1;
|
||||
@@ -390,7 +398,7 @@ int32_t zeitraffer_app(void* p) {
|
||||
}
|
||||
if(!flipper_format_write_comment_cstr(
|
||||
save,
|
||||
"Zeitraffer app settings: n of frames, interval time, backlight type, Delay")) {
|
||||
"Zeitraffer app settings: № of frames, interval time, backlight type, Delay")) {
|
||||
notification_message(notifications, &sequence_error);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 116 B |