Merge branch 'ofw_dev' into dev

This commit is contained in:
MX 2023-10-15 01:30:55 +03:00
commit b87a8ca329
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
19 changed files with 105 additions and 79 deletions

View file

@ -294,7 +294,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil
return delay_val;
} else if(delay_val < 0) { // Script error
bad_usb->st.error_line = bad_usb->st.line_cur - 1;
FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_usb->st.line_cur - 1U);
FURI_LOG_E(WORKER_TAG, "Unknown command at line %zu", bad_usb->st.line_cur - 1U);
return SCRIPT_STATE_ERROR;
} else {
return (delay_val + bad_usb->defdelay);
@ -333,7 +333,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil
return delay_val;
} else if(delay_val < 0) {
bad_usb->st.error_line = bad_usb->st.line_cur;
FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_usb->st.line_cur);
FURI_LOG_E(WORKER_TAG, "Unknown command at line %zu", bad_usb->st.line_cur);
return SCRIPT_STATE_ERROR;
} else {
return (delay_val + bad_usb->defdelay);

View file

@ -24,10 +24,10 @@ typedef enum {
typedef struct {
BadUsbWorkerState state;
uint16_t line_cur;
uint16_t line_nb;
size_t line_cur;
size_t line_nb;
uint32_t delay_remain;
uint16_t error_line;
size_t error_line;
char error[64];
} BadUsbState;

View file

@ -82,7 +82,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) {
canvas_set_font(canvas, FontPrimary);
canvas_draw_str_aligned(canvas, 127, 33, AlignRight, AlignBottom, "ERROR:");
canvas_set_font(canvas, FontSecondary);
furi_string_printf(disp_str, "line %u", model->state.error_line);
furi_string_printf(disp_str, "line %zu", model->state.error_line);
canvas_draw_str_aligned(
canvas, 127, 46, AlignRight, AlignBottom, furi_string_get_cstr(disp_str));
furi_string_reset(disp_str);
@ -105,7 +105,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) {
}
canvas_set_font(canvas, FontBigNumbers);
furi_string_printf(
disp_str, "%u", ((model->state.line_cur - 1) * 100) / model->state.line_nb);
disp_str, "%zu", ((model->state.line_cur - 1) * 100) / model->state.line_nb);
canvas_draw_str_aligned(
canvas, 114, 40, AlignRight, AlignBottom, furi_string_get_cstr(disp_str));
furi_string_reset(disp_str);
@ -124,7 +124,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) {
}
canvas_set_font(canvas, FontBigNumbers);
furi_string_printf(
disp_str, "%u", ((model->state.line_cur - 1) * 100) / model->state.line_nb);
disp_str, "%zu", ((model->state.line_cur - 1) * 100) / model->state.line_nb);
canvas_draw_str_aligned(
canvas, 114, 40, AlignRight, AlignBottom, furi_string_get_cstr(disp_str));
furi_string_reset(disp_str);
@ -142,7 +142,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) {
}
canvas_set_font(canvas, FontBigNumbers);
furi_string_printf(
disp_str, "%u", ((model->state.line_cur - 1) * 100) / model->state.line_nb);
disp_str, "%zu", ((model->state.line_cur - 1) * 100) / model->state.line_nb);
canvas_draw_str_aligned(
canvas, 114, 40, AlignRight, AlignBottom, furi_string_get_cstr(disp_str));
furi_string_reset(disp_str);

View file

@ -351,7 +351,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
subghz->txrx, "AM650", 315000000, SUBGHZ_PROTOCOL_PRINCETON_NAME, key, 24, 400);
break;
case SubmenuIndexNiceFlo12bit:
key = (key & 0x0000FFF0) | 0x1; //btn 0x1, 0x2, 0x4
key = (key & 0x00000FF0) | 0x1; //btn 0x1, 0x2, 0x4
generated_protocol = subghz_txrx_gen_data_protocol(
subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_NICE_FLO_NAME, key, 12);
break;
@ -361,7 +361,7 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_NICE_FLO_NAME, key, 24);
break;
case SubmenuIndexCAME12bit:
key = (key & 0x0000FFF0) | 0x1; //btn 0x1, 0x2, 0x4
key = (key & 0x00000FF0) | 0x1; //btn 0x1, 0x2, 0x4
generated_protocol = subghz_txrx_gen_data_protocol(
subghz->txrx, "AM650", 433920000, SUBGHZ_PROTOCOL_CAME_NAME, key, 12);
break;
@ -715,14 +715,17 @@ bool subghz_scene_set_type_on_event(void* context, SceneManagerEvent event) {
subghz_txrx_gen_secplus_v1_protocol(subghz->txrx, "AM650", 433920000);
break;
case SubmenuIndexSecPlus_v2_310_00:
key = (key & 0x7FFFF3FC); // 850LM pairing
generated_protocol = subghz_txrx_gen_secplus_v2_protocol(
subghz->txrx, "AM650", 310000000, key, 0x68, 0xE500000);
break;
case SubmenuIndexSecPlus_v2_315_00:
key = (key & 0x7FFFF3FC); // 850LM pairing
generated_protocol = subghz_txrx_gen_secplus_v2_protocol(
subghz->txrx, "AM650", 315000000, key, 0x68, 0xE500000);
break;
case SubmenuIndexSecPlus_v2_390_00:
key = (key & 0x7FFFF3FC); // 850LM pairing
generated_protocol = subghz_txrx_gen_secplus_v2_protocol(
subghz->txrx, "AM650", 390000000, key, 0x68, 0xE500000);
break;

View file

@ -558,7 +558,7 @@ void subghz_cli_command_decode_raw(Cli* cli, FuriString* args, void* context) {
}
}
printf("\r\nPackets received \033[0;32m%u\033[0m\r\n", instance->packet_count);
printf("\r\nPackets received \033[0;32m%zu\033[0m\r\n", instance->packet_count);
// Cleanup
subghz_receiver_free(receiver);

View file

@ -225,18 +225,35 @@ static void byte_input_draw_input(Canvas* canvas, ByteInputModel* model) {
byte_input_get_nibble_text(model->bytes[i], false));
canvas_invert_color(canvas);
}
} else {
if(model->first_visible_byte > 0 && i == model->first_visible_byte) {
canvas_draw_icon(
canvas,
text_x + 2 + byte_position * 14,
text_y - 7,
&I_More_data_placeholder_5x7);
} else {
canvas_draw_glyph(
canvas,
text_x + 2 + byte_position * 14,
text_y,
byte_input_get_nibble_text(model->bytes[i], true));
}
if(model->bytes_count - model->first_visible_byte > max_drawable_bytes &&
i == model->first_visible_byte + MIN(model->bytes_count, max_drawable_bytes) - 1) {
canvas_draw_icon(
canvas,
text_x + 8 + byte_position * 14,
text_y - 7,
&I_More_data_placeholder_5x7);
} else {
canvas_draw_glyph(
canvas,
text_x + 8 + byte_position * 14,
text_y,
byte_input_get_nibble_text(model->bytes[i], false));
}
}
if(draw_index_line) {
canvas_draw_icon(canvas, 1, text_y + 8, &I_Hashmark_7x7);
@ -260,14 +277,6 @@ static void byte_input_draw_input(Canvas* canvas, ByteInputModel* model) {
snprintf(str, 20, "%u", (model->selected_byte + 1));
canvas_draw_str(canvas, text_x + 75, text_y2, str);
}
if(model->bytes_count - model->first_visible_byte > max_drawable_bytes) {
canvas_draw_icon(canvas, 123, 21, &I_ButtonRightSmall_3x5);
}
if(model->first_visible_byte > 0) {
canvas_draw_icon(canvas, 1, 21, &I_ButtonLeftSmall_3x5);
}
}
/** Draw input box (selected view)
@ -305,12 +314,28 @@ static void byte_input_draw_input_selected(Canvas* canvas, ByteInputModel* model
text_y,
byte_input_get_nibble_text(model->bytes[i], false));
canvas_invert_color(canvas);
} else {
if(model->first_visible_byte > 0 && i == model->first_visible_byte) {
canvas_draw_icon(
canvas,
text_x + 2 + byte_position * 14,
text_y - 7,
&I_More_data_placeholder_5x7);
} else {
canvas_draw_glyph(
canvas,
text_x + 2 + byte_position * 14,
text_y,
byte_input_get_nibble_text(model->bytes[i], true));
}
if(model->bytes_count - model->first_visible_byte > max_drawable_bytes &&
i == model->first_visible_byte + MIN(model->bytes_count, max_drawable_bytes) - 1) {
canvas_draw_icon(
canvas,
text_x + 8 + byte_position * 14,
text_y - 7,
&I_More_data_placeholder_5x7);
} else {
canvas_draw_glyph(
canvas,
text_x + 8 + byte_position * 14,
@ -318,13 +343,6 @@ static void byte_input_draw_input_selected(Canvas* canvas, ByteInputModel* model
byte_input_get_nibble_text(model->bytes[i], false));
}
}
if(model->bytes_count - model->first_visible_byte > max_drawable_bytes) {
canvas_draw_icon(canvas, 123, 21, &I_ButtonRightSmall_3x5);
}
if(model->first_visible_byte > 0) {
canvas_draw_icon(canvas, 1, 21, &I_ButtonLeftSmall_3x5);
}
canvas_invert_color(canvas);

View file

@ -869,7 +869,7 @@ bool storage_simply_remove_recursive(Storage* storage, const char* path) {
while(storage_dir_read(dir, &fileinfo, name, MAX_NAME_LENGTH)) {
if(file_info_is_dir(&fileinfo)) {
furi_string_cat_printf(cur_dir, "/%s", name);
furi_string_cat_printf(cur_dir, "/%s", name); //-V576
go_deeper = true;
break;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B

View file

@ -118,7 +118,6 @@ void furi_hal_clock_init() {
NVIC_EnableIRQ(SysTick_IRQn);
LL_RCC_SetCLK48ClockSource(LL_RCC_CLK48_CLKSOURCE_PLLSAI1);
LL_RCC_HSI_EnableInStopMode(); // Ensure that MR is capable of work in STOP0
LL_RCC_SetSMPSClockSource(LL_RCC_SMPS_CLKSOURCE_HSI);
LL_RCC_SetSMPSPrescaler(LL_RCC_SMPS_DIV_1);
LL_RCC_SetRFWKPClockSource(LL_RCC_RFWKP_CLKSOURCE_LSE);
@ -133,7 +132,7 @@ void furi_hal_clock_switch_hse2hsi() {
;
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSI);
furi_assert(LL_RCC_GetSMPSClockSource() == LL_RCC_SMPS_CLKSOURCE_HSI);
furi_assert(LL_RCC_GetSMPSClockSelection() == LL_RCC_SMPS_CLKSOURCE_HSI);
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSI)
;

View file

@ -65,6 +65,10 @@ void furi_hal_power_init() {
LL_PWR_SetPowerMode(FURI_HAL_POWER_STOP_MODE);
LL_C2_PWR_SetPowerMode(FURI_HAL_POWER_STOP_MODE);
#if FURI_HAL_POWER_STOP_MODE == LL_PWR_MODE_STOP0
LL_RCC_HSI_EnableInStopMode(); // Ensure that MR is capable of work in STOP0
#endif
furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
// Find and init gauge
if(bq27220_init(&furi_hal_i2c_handle_power)) {
@ -206,8 +210,11 @@ static inline void furi_hal_power_deep_sleep() {
while(LL_HSEM_1StepLock(HSEM, CFG_HW_RCC_SEMID))
;
if(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSE) {
if(LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_HSI) {
furi_hal_clock_switch_hsi2hse();
} else {
// Ensure that we are already on HSE
furi_check(LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_HSE);
}
LL_HSEM_ReleaseLock(HSEM, CFG_HW_RCC_SEMID, 0);

View file

@ -331,13 +331,12 @@ void CALLBACK_CCID_IccPowerOn(
if(callbacks[CCID_SLOT_INDEX] != NULL) {
callbacks[CCID_SLOT_INDEX]->icc_power_on_callback(
responseDataBlock->abData, &responseDataBlock->dwLength, NULL);
responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR |
CCID_ICCSTATUS_PRESENTANDACTIVE;
} else {
responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR |
CCID_ICCSTATUS_PRESENTANDINACTIVE;
}
responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR |
CCID_ICCSTATUS_PRESENTANDACTIVE;
} else {
responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR |
CCID_ICCSTATUS_NOICCPRESENT;
@ -366,13 +365,12 @@ void CALLBACK_CCID_XfrBlock(
responseDataBlock->abData,
&responseDataBlock->dwLength,
NULL);
responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR |
CCID_ICCSTATUS_PRESENTANDACTIVE;
} else {
responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR |
CCID_ICCSTATUS_PRESENTANDINACTIVE;
}
responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR |
CCID_ICCSTATUS_PRESENTANDACTIVE;
} else {
responseDataBlock->bStatus = CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR |
CCID_ICCSTATUS_NOICCPRESENT;
@ -413,11 +411,11 @@ static void ccid_tx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) {
usb_dev, ep, &ReceiveBuffer, sizeof(ccid_bulk_message_header_t) + CCID_DATABLOCK_SIZE);
//minimum request size is header size
furi_assert((uint16_t)bytes_read >= sizeof(ccid_bulk_message_header_t));
ccid_bulk_message_header_t* message = (ccid_bulk_message_header_t*)&ReceiveBuffer;
ccid_bulk_message_header_t* message = (ccid_bulk_message_header_t*)&ReceiveBuffer; //-V641
if(message->bMessageType == PC_TO_RDR_ICCPOWERON) {
struct pc_to_rdr_icc_power_on* requestDataBlock =
(struct pc_to_rdr_icc_power_on*)message;
(struct pc_to_rdr_icc_power_on*)message; //-V641
struct rdr_to_pc_data_block* responseDataBlock =
(struct rdr_to_pc_data_block*)&SendBuffer;
@ -432,9 +430,9 @@ static void ccid_tx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) {
(sizeof(uint8_t) * responseDataBlock->dwLength));
} else if(message->bMessageType == PC_TO_RDR_ICCPOWEROFF) {
struct pc_to_rdr_icc_power_off* requestIccPowerOff =
(struct pc_to_rdr_icc_power_off*)message;
(struct pc_to_rdr_icc_power_off*)message; //-V641
struct rdr_to_pc_slot_status* responseSlotStatus =
(struct rdr_to_pc_slot_status*)&SendBuffer;
(struct rdr_to_pc_slot_status*)&SendBuffer; //-V641
CALLBACK_CCID_GetSlotStatus(
requestIccPowerOff->bSlot, requestIccPowerOff->bSeq, responseSlotStatus);
@ -443,9 +441,9 @@ static void ccid_tx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) {
usb_dev, CCID_IN_EPADDR, responseSlotStatus, sizeof(struct rdr_to_pc_slot_status));
} else if(message->bMessageType == PC_TO_RDR_GETSLOTSTATUS) {
struct pc_to_rdr_get_slot_status* requestSlotStatus =
(struct pc_to_rdr_get_slot_status*)message;
(struct pc_to_rdr_get_slot_status*)message; //-V641
struct rdr_to_pc_slot_status* responseSlotStatus =
(struct rdr_to_pc_slot_status*)&SendBuffer;
(struct rdr_to_pc_slot_status*)&SendBuffer; //-V641
CALLBACK_CCID_GetSlotStatus(
requestSlotStatus->bSlot, requestSlotStatus->bSeq, responseSlotStatus);
@ -474,9 +472,9 @@ static void ccid_tx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) {
(sizeof(uint8_t) * responseDataBlock->dwLength));
} else if(message->bMessageType == PC_TO_RDR_SETPARAMETERS) {
struct pc_to_rdr_set_parameters_t0* requestSetParametersT0 =
(struct pc_to_rdr_set_parameters_t0*)message;
(struct pc_to_rdr_set_parameters_t0*)message; //-V641
struct rdr_to_pc_parameters_t0* responseSetParametersT0 =
(struct rdr_to_pc_parameters_t0*)&SendBuffer;
(struct rdr_to_pc_parameters_t0*)&SendBuffer; //-V641
furi_assert(requestSetParametersT0->dwLength <= CCID_DATABLOCK_SIZE);
furi_assert(

View file

@ -70,7 +70,8 @@ static bool flipper_update_load_stage(const FuriString* work_dir, UpdateManifest
if((f_stat(furi_string_get_cstr(loader_img_path), &stat) != FR_OK) ||
(f_open(&file, furi_string_get_cstr(loader_img_path), FA_OPEN_EXISTING | FA_READ) !=
FR_OK)) {
FR_OK) ||
(stat.fsize == 0)) {
furi_string_free(loader_img_path);
return false;
}
@ -83,7 +84,7 @@ static bool flipper_update_load_stage(const FuriString* work_dir, UpdateManifest
uint32_t crc = 0;
do {
uint16_t size_read = 0;
if(f_read(&file, img + bytes_read, MAX_READ, &size_read) != FR_OK) {
if(f_read(&file, img + bytes_read, MAX_READ, &size_read) != FR_OK) { //-V769
break;
}
crc = crc32_calc_buffer(crc, img + bytes_read, size_read);

View file

@ -153,18 +153,18 @@ FURI_NORETURN void __furi_crash() {
__furi_print_heap_info();
__furi_print_bt_stack_info();
#ifndef FURI_DEBUG
// Check if debug enabled by DAP
// https://developer.arm.com/documentation/ddi0403/d/Debug-Architecture/ARMv7-M-Debug/Debug-register-support-in-the-SCS/Debug-Halting-Control-and-Status-Register--DHCSR?lang=en
bool debug = CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk;
#ifdef FURI_NDEBUG
if(debug) {
#endif
furi_hal_console_puts("\r\nSystem halted. Connect debugger for more info\r\n");
furi_hal_console_puts("\033[0m\r\n");
furi_hal_debug_enable();
RESTORE_REGISTERS_AND_HALT_MCU(true);
#ifndef FURI_DEBUG
RESTORE_REGISTERS_AND_HALT_MCU(debug);
#ifdef FURI_NDEBUG
} else {
uint32_t ptr = (uint32_t)__furi_check_message;
if(ptr < FLASH_BASE || ptr > (FLASH_BASE + FLASH_SIZE)) {

View file

@ -115,8 +115,9 @@ static size_t xBlockAllocatedBit = 0;
#include <m-dict.h>
/* Allocation tracking types */
DICT_DEF2(MemmgrHeapAllocDict, uint32_t, uint32_t)
DICT_DEF2(
DICT_DEF2(MemmgrHeapAllocDict, uint32_t, uint32_t) //-V1048
DICT_DEF2( //-V1048
MemmgrHeapThreadDict,
uint32_t,
M_DEFAULT_OPLIST,

View file

@ -853,7 +853,7 @@ ElfProcessSectionResult elf_process_section(
if(process_section(elf->fd, section_header.sh_offset, section_header.sh_size, context)) {
result = ElfProcessSectionResultSuccess;
} else {
result = ElfProcessSectionResultCannotProcess;
result = ElfProcessSectionResultCannotProcess; //-V1048
}
}

View file

@ -6,7 +6,7 @@
extern "C" {
#endif
DICT_DEF2(AddressCache, int, M_DEFAULT_OPLIST, Elf32_Addr, M_DEFAULT_OPLIST)
DICT_DEF2(AddressCache, int, M_DEFAULT_OPLIST, Elf32_Addr, M_DEFAULT_OPLIST) //-V1048
/**
* Callable elf entry type

View file

@ -118,7 +118,6 @@ void lfrfid_worker_start_thread(LFRFIDWorker* worker) {
}
void lfrfid_worker_stop_thread(LFRFIDWorker* worker) {
furi_assert(worker->mode_index == LFRFIDWorkerIdle);
furi_thread_flags_set(furi_thread_get_id(worker->thread), LFRFIDEventStopThread);
furi_thread_join(worker->thread);
}

View file

@ -197,7 +197,7 @@ ReturnCode slix_get_random(NfcVData* data) {
}
ReturnCode slix_unlock(NfcVData* data, uint32_t password_id) {
furi_assert(rand);
furi_assert(data);
uint16_t received = 0;
uint8_t rxBuf[32];

View file

@ -2,8 +2,8 @@
#include <furi_hal.h>
#define CONTRAST_ERC 31
#define CONTRAST_MGG 27
#define CONTRAST_ERC 32
#define CONTRAST_MGG 28
uint8_t u8g2_gpio_and_delay_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr) {
UNUSED(u8x8);