Skip to content

Commit

Permalink
chore: run fbt
Browse files Browse the repository at this point in the history
  • Loading branch information
xtruan committed Dec 10, 2024
1 parent adb4dbd commit ad09400
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 41 deletions.
2 changes: 1 addition & 1 deletion chess/smallchesslib.h
Original file line number Diff line number Diff line change
Expand Up @@ -3515,4 +3515,4 @@ uint8_t SCL_boardMoveIsLegal(SCL_Board board, uint8_t squareFrom, uint8_t square
return SCL_squareSetContains(moves, squareTo);
}

#endif // guard
#endif // guard
7 changes: 5 additions & 2 deletions flipchess.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define FLIPCHESS_VERSION "v1.11"

#define TEXT_BUFFER_SIZE 96
#define TEXT_SIZE (TEXT_BUFFER_SIZE - 1)
#define TEXT_SIZE (TEXT_BUFFER_SIZE - 1)

typedef struct {
Gui* gui;
Expand Down Expand Up @@ -65,7 +65,10 @@ typedef enum {
FlipChessPlayerAI3 = 3,
} FlipChessPlayerMode;

typedef enum { FlipChessTextInputDefault, FlipChessTextInputGame } FlipChessTextInputState;
typedef enum {
FlipChessTextInputDefault,
FlipChessTextInputGame
} FlipChessTextInputState;

typedef enum {
FlipChessStatusNone = 0,
Expand Down
2 changes: 1 addition & 1 deletion helpers/flipchess_custom_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ typedef enum {
FlipChessCustomEventScene1Right,
FlipChessCustomEventScene1Ok,
FlipChessCustomEventScene1Back,
} FlipChessCustomEvent;
} FlipChessCustomEvent;
12 changes: 6 additions & 6 deletions helpers/flipchess_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#include <loader/loader.h>

// #define FLIPCHESS_APP_BASE_FOLDER APP_BOARDA_PATH("flipchess")
#define FLIPCHESS_APP_BASE_FOLDER EXT_PATH("apps_data/flipchess")
#define FLIPCHESS_APP_BASE_FOLDER EXT_PATH("apps_data/flipchess")
#define FLIPCHESS_APP_BASE_FOLDER_PATH(path) FLIPCHESS_APP_BASE_FOLDER "/" path
#define FLIPCHESS_BOARD_FILE_NAME "board_fen.txt"
#define FLIPCHESS_BOARD_FILE_NAME_BAK "board_fen.bak"
#define FLIPCHESS_BOARD_PATH FLIPCHESS_APP_BASE_FOLDER_PATH(FLIPCHESS_BOARD_FILE_NAME)
#define FLIPCHESS_BOARD_PATH_BAK FLIPCHESS_APP_BASE_FOLDER_PATH(FLIPCHESS_BOARD_FILE_NAME_BAK)
#define FLIPCHESS_BOARD_FILE_NAME "board_fen.txt"
#define FLIPCHESS_BOARD_FILE_NAME_BAK "board_fen.bak"
#define FLIPCHESS_BOARD_PATH FLIPCHESS_APP_BASE_FOLDER_PATH(FLIPCHESS_BOARD_FILE_NAME)
#define FLIPCHESS_BOARD_PATH_BAK FLIPCHESS_APP_BASE_FOLDER_PATH(FLIPCHESS_BOARD_FILE_NAME_BAK)

#define FILE_MAX_PATH_LEN 48
#define FILE_MAX_CHARS 94
#define FILE_MAX_CHARS 94

bool flipchess_has_file(const FlipChessFile file_type, const char* file_name, const bool remove) {
bool ret = false;
Expand Down
2 changes: 1 addition & 1 deletion helpers/flipchess_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ bool flipchess_save_file(
const FlipChessFile file_type,
const char* file_name,
const bool append,
const bool overwrite);
const bool overwrite);
2 changes: 1 addition & 1 deletion helpers/flipchess_voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ void flipchess_voice_a_strange_game() {
voice.say("A STRANGE GAME... THE ONLY WINNING MOVE IS NOT TO PLAY.");
furi_hal_speaker_release();
}
}
}
8 changes: 5 additions & 3 deletions sam/stm32_sam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3304,7 +3304,8 @@ void STM32SAM::AddInflection(unsigned char mem48, unsigned char phase1) {

// FIXME: Explain this fix better, it's not obvious
// ML : A =, fixes a problem with invalid pitch with '.'
while((A = pitches[X]) == 127) X++;
while((A = pitches[X]) == 127)
X++;

pos48398:
//48398: CLC
Expand Down Expand Up @@ -3787,7 +3788,8 @@ int STM32SAM::Parser1() {
Y = 0;

// CLEAR THE STRESS TABLE
for(i = 0; i < 256; i++) stress[i] = 0;
for(i = 0; i < 256; i++)
stress[i] = 0;

// THIS CODE MATCHES THE PHONEME LETTERS TO THE TABLE
// pos41078:
Expand Down Expand Up @@ -5628,7 +5630,7 @@ void STM32SAM::setThroat(unsigned char _throat /* = 128 */) {
#include <math.h>
#include <stm32wbxx_ll_tim.h>

#define FURI_HAL_SPEAKER_TIMER TIM16
#define FURI_HAL_SPEAKER_TIMER TIM16
#define FURI_HAL_SPEAKER_CHANNEL LL_TIM_CHANNEL_CH1

void STM32SAM::begin(void) {
Expand Down
2 changes: 1 addition & 1 deletion sam/stm32_sam.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ class STM32SAM {

}; // STM32SAM class

#endif
#endif
2 changes: 1 addition & 1 deletion scenes/flipchess_scene_config.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ADD_SCENE(flipchess, startscreen, Startscreen)
ADD_SCENE(flipchess, menu, Menu)
ADD_SCENE(flipchess, scene_1, Scene_1)
ADD_SCENE(flipchess, settings, Settings)
ADD_SCENE(flipchess, settings, Settings)
2 changes: 1 addition & 1 deletion scenes/flipchess_scene_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ bool flipchess_scene_menu_on_event(void* context, SceneManagerEvent event) {
void flipchess_scene_menu_on_exit(void* context) {
FlipChess* app = context;
submenu_reset(app->submenu);
}
}
2 changes: 1 addition & 1 deletion scenes/flipchess_scene_scene_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ void flipchess_scene_scene_1_on_exit(void* context) {
if(app->import_game == 1 && strlen(app->import_game_text) > 0) {
flipchess_save_file(app->import_game_text, FlipChessFileBoard, NULL, false, true);
}
}
}
4 changes: 2 additions & 2 deletions scenes/flipchess_scene_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "../helpers/flipchess_voice.h"
#include <lib/toolbox/value_index.h>

#define TEXT_LABEL_ON "ON"
#define TEXT_LABEL_ON "ON"
#define TEXT_LABEL_OFF "OFF"

const char* const haptic_text[2] = {
Expand Down Expand Up @@ -99,4 +99,4 @@ void flipchess_scene_settings_on_exit(void* context) {
FlipChess* app = context;
variable_item_list_set_selected_item(app->variable_item_list, 0);
variable_item_list_reset(app->variable_item_list);
}
}
2 changes: 1 addition & 1 deletion scenes/flipchess_scene_startscreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ void flipchess_scene_startscreen_on_exit(void* context) {
if(app->sound == 1) {
flipchess_voice_shall_we_play();
}
}
}
27 changes: 12 additions & 15 deletions views/flipchess_scene_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
#include "../helpers/flipchess_voice.h"
#include "../helpers/flipchess_haptic.h"

#define SCL_960_CASTLING 0 // setting to 1 compiles a 960 version of smolchess
#define XBOARD_DEBUG 0 // will create files with xboard communication
#define SCL_960_CASTLING 0 // setting to 1 compiles a 960 version of smolchess
#define XBOARD_DEBUG 0 // will create files with xboard communication
#define SCL_EVALUATION_FUNCTION SCL_boardEvaluateStatic
#define SCL_DEBUG_AI 0
#define SCL_DEBUG_AI 0

#include "../chess/smallchesslib.h"

#define ENABLE_960 0 // setting to 1 enables 960 chess
#define MAX_TEXT_LEN 15 // 15 = max length of text
#define MAX_TEXT_BUF (MAX_TEXT_LEN + 1) // max length of text + null terminator
#define ENABLE_960 0 // setting to 1 enables 960 chess
#define MAX_TEXT_LEN 15 // 15 = max length of text
#define MAX_TEXT_BUF (MAX_TEXT_LEN + 1) // max length of text + null terminator
#define THREAD_WAIT_TIME 20 // time to wait for draw thread to finish

struct FlipChessScene1 {
Expand Down Expand Up @@ -231,15 +231,14 @@ uint8_t flipchess_turn(FlipChessScene1Model* model) {
// Color check before allowing piece selection
char piece = model->game.board[model->squareSelected];
if(piece != '.' &&
SCL_pieceIsWhite(piece) == SCL_boardWhitesTurn(model->game.board)) {
SCL_pieceIsWhite(piece) == SCL_boardWhitesTurn(model->game.board)) {
model->squareFrom = model->squareSelected;
model->turnState = 1;
}
} else if(model->turnState == 1 && model->squareSelected != 255) {
// Validate before executing
if(SCL_boardMoveIsLegal(model->game.board,
model->squareFrom,
model->squareSelected)) {
if(SCL_boardMoveIsLegal(
model->game.board, model->squareFrom, model->squareSelected)) {
model->squareTo = model->squareSelected;
model->turnState = 2;
model->squareSelectedLast = model->squareSelected;
Expand Down Expand Up @@ -665,8 +664,7 @@ void flipchess_scene_1_exit(void* context) {
furi_assert(context);
FlipChessScene1* instance = (FlipChessScene1*)context;

with_view_model(
instance->view, FlipChessScene1Model * model, { model->paramExit = 0; }, true);
with_view_model(instance->view, FlipChessScene1Model * model, { model->paramExit = 0; }, true);
}

void flipchess_scene_1_enter(void* context) {
Expand Down Expand Up @@ -727,8 +725,7 @@ FlipChessScene1* flipchess_scene_1_alloc() {
void flipchess_scene_1_free(FlipChessScene1* instance) {
furi_assert(instance);

with_view_model(
instance->view, FlipChessScene1Model * model, { UNUSED(model); }, true);
with_view_model(instance->view, FlipChessScene1Model * model, { UNUSED(model); }, true);

view_free(instance->view);
free(instance);
Expand All @@ -737,4 +734,4 @@ void flipchess_scene_1_free(FlipChessScene1* instance) {
View* flipchess_scene_1_get_view(FlipChessScene1* instance) {
furi_assert(instance);
return instance->view;
}
}
2 changes: 1 addition & 1 deletion views/flipchess_scene_1.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ View* flipchess_scene_1_get_view(FlipChessScene1* flipchess_static);

FlipChessScene1* flipchess_scene_1_alloc();

void flipchess_scene_1_free(FlipChessScene1* flipchess_static);
void flipchess_scene_1_free(FlipChessScene1* flipchess_static);
3 changes: 1 addition & 2 deletions views/flipchess_startscreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ FlipChessStartscreen* flipchess_startscreen_alloc() {
void flipchess_startscreen_free(FlipChessStartscreen* instance) {
furi_assert(instance);

with_view_model(
instance->view, FlipChessStartscreenModel * model, { UNUSED(model); }, true);
with_view_model(instance->view, FlipChessStartscreenModel * model, { UNUSED(model); }, true);
view_free(instance->view);
free(instance);
}
Expand Down
2 changes: 1 addition & 1 deletion views/flipchess_startscreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ View* flipchess_startscreen_get_view(FlipChessStartscreen* flipchess_static);

FlipChessStartscreen* flipchess_startscreen_alloc();

void flipchess_startscreen_free(FlipChessStartscreen* flipchess_static);
void flipchess_startscreen_free(FlipChessStartscreen* flipchess_static);

0 comments on commit ad09400

Please sign in to comment.