mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Merge remote-tracking branch 'ul/dev' into mntm-dev --nobuild
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
- OFW: CCID: App changes and improvements (by @kidbomb)
|
||||
- OFW: API: Exposed `view_dispatcher_get_event_loop` (by @CookiePLMonster)
|
||||
- Furi:
|
||||
- UL: Extra checks for OTG power enable/disable (by @xMasterX)
|
||||
- OFW: Replace all calls to strncpy with strlcpy, use strdup more, expose strlcat (by @CookiePLMonster)
|
||||
- OFW: Threading, Timers improvements (by @CookiePLMonster)
|
||||
- OFW: FuriTimer uses an event instead of a volatile bool to wait for deletion (by @CookiePLMonster)
|
||||
|
||||
@@ -94,9 +94,9 @@ bool gpio_scene_start_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == GpioStartEventOtgOn) {
|
||||
furi_hal_power_enable_otg();
|
||||
if(!furi_hal_power_is_otg_enabled()) furi_hal_power_enable_otg();
|
||||
} else if(event.event == GpioStartEventOtgOff) {
|
||||
furi_hal_power_disable_otg();
|
||||
if(furi_hal_power_is_otg_enabled()) furi_hal_power_disable_otg();
|
||||
} else if(event.event == GpioStartEventManualControl) {
|
||||
scene_manager_set_scene_state(app->scene_manager, GpioSceneStart, GpioItemTest);
|
||||
scene_manager_next_scene(app->scene_manager, GpioSceneTest);
|
||||
|
||||
@@ -460,9 +460,9 @@ void infrared_set_tx_pin(InfraredApp* infrared, FuriHalInfraredTxPin tx_pin) {
|
||||
|
||||
void infrared_enable_otg(InfraredApp* infrared, bool enable) {
|
||||
if(enable) {
|
||||
furi_hal_power_enable_otg();
|
||||
if(!furi_hal_power_is_otg_enabled()) furi_hal_power_enable_otg();
|
||||
} else {
|
||||
furi_hal_power_disable_otg();
|
||||
if(furi_hal_power_is_otg_enabled()) furi_hal_power_disable_otg();
|
||||
}
|
||||
infrared->app_state.is_otg_enabled = enable;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ static void onewire_cli_search(Cli* cli) {
|
||||
printf("Search started\r\n");
|
||||
|
||||
onewire_host_start(onewire);
|
||||
furi_hal_power_enable_otg();
|
||||
if(!furi_hal_power_is_otg_enabled()) furi_hal_power_enable_otg();
|
||||
|
||||
while(!done) {
|
||||
if(onewire_host_search(onewire, address, OneWireHostSearchModeNormal) != 1) {
|
||||
@@ -37,7 +37,7 @@ static void onewire_cli_search(Cli* cli) {
|
||||
furi_delay_ms(100);
|
||||
}
|
||||
|
||||
furi_hal_power_disable_otg();
|
||||
if(furi_hal_power_is_otg_enabled()) furi_hal_power_disable_otg();
|
||||
onewire_host_free(onewire);
|
||||
}
|
||||
|
||||
|
||||
@@ -387,14 +387,23 @@ void subghz_txrx_gen_serial_gangqi(uint64_t* result_key) {
|
||||
uint64_t randkey;
|
||||
uint64_t only_required_bytes;
|
||||
uint16_t sum_of_3bytes;
|
||||
uint8_t xorbytes;
|
||||
|
||||
do {
|
||||
randkey = (uint64_t)rand();
|
||||
only_required_bytes = (randkey & 0xFFFFF0000);
|
||||
only_required_bytes = (randkey & 0x0FFFF0000) | 0x200000000;
|
||||
sum_of_3bytes = ((only_required_bytes >> 32) & 0xFF) +
|
||||
((only_required_bytes >> 24) & 0xFF) +
|
||||
((only_required_bytes >> 16) & 0xFF);
|
||||
} while(!((!(sum_of_3bytes & 0x3)) && ((0xb2 < sum_of_3bytes) && (sum_of_3bytes < 0x1ae))));
|
||||
xorbytes = ((only_required_bytes >> 32) & 0xFF) ^ ((only_required_bytes >> 24) & 0xFF) ^
|
||||
((only_required_bytes >> 16) & 0xFF);
|
||||
} while(
|
||||
!((((!(sum_of_3bytes & 0x3)) && ((0xB < sum_of_3bytes) && (sum_of_3bytes < 0x141))) &&
|
||||
((((only_required_bytes >> 32) & 0xFF) == 0x2) ||
|
||||
(((only_required_bytes >> 32) & 0xFF) == 0x3))) &&
|
||||
((((xorbytes == 0xBA) || (xorbytes == 0xE2)) ||
|
||||
((xorbytes == 0x3A) || (xorbytes == 0xF2))) ||
|
||||
(xorbytes == 0xB2))));
|
||||
|
||||
// Serial 01 button 01
|
||||
uint64_t new_key = only_required_bytes | (0b01 << 14) | (0xD << 10) | (0b01 << 8);
|
||||
|
||||
@@ -251,9 +251,9 @@ static bool expansion_worker_handle_state_connected(
|
||||
if(!expansion_worker_rpc_session_open(instance)) break;
|
||||
instance->state = ExpansionWorkerStateRpcActive;
|
||||
} else if(command == ExpansionFrameControlCommandEnableOtg) {
|
||||
furi_hal_power_enable_otg();
|
||||
if(!furi_hal_power_is_otg_enabled()) furi_hal_power_enable_otg();
|
||||
} else if(command == ExpansionFrameControlCommandDisableOtg) {
|
||||
furi_hal_power_disable_otg();
|
||||
if(furi_hal_power_is_otg_enabled()) furi_hal_power_disable_otg();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -219,9 +219,9 @@ void rpc_system_gpio_set_otg_mode(const PB_Main* request, void* context) {
|
||||
const PB_Gpio_GpioOtgMode mode = request->content.gpio_set_otg_mode.mode;
|
||||
|
||||
if(mode == PB_Gpio_GpioOtgMode_OFF) {
|
||||
furi_hal_power_disable_otg();
|
||||
if(furi_hal_power_is_otg_enabled()) furi_hal_power_disable_otg();
|
||||
} else {
|
||||
furi_hal_power_enable_otg();
|
||||
if(!furi_hal_power_is_otg_enabled()) furi_hal_power_enable_otg();
|
||||
}
|
||||
|
||||
rpc_send_and_release_empty(session, request->command_id, PB_CommandStatus_OK);
|
||||
|
||||
@@ -75,7 +75,7 @@ void ibutton_worker_mode_idle_stop(iButtonWorker* worker) {
|
||||
|
||||
void ibutton_worker_mode_read_start(iButtonWorker* worker) {
|
||||
UNUSED(worker);
|
||||
furi_hal_power_enable_otg();
|
||||
if(!furi_hal_power_is_otg_enabled()) furi_hal_power_enable_otg();
|
||||
}
|
||||
|
||||
void ibutton_worker_mode_read_tick(iButtonWorker* worker) {
|
||||
@@ -90,7 +90,7 @@ void ibutton_worker_mode_read_tick(iButtonWorker* worker) {
|
||||
|
||||
void ibutton_worker_mode_read_stop(iButtonWorker* worker) {
|
||||
UNUSED(worker);
|
||||
furi_hal_power_disable_otg();
|
||||
if(furi_hal_power_is_otg_enabled()) furi_hal_power_disable_otg();
|
||||
}
|
||||
|
||||
/*********************** EMULATE ***********************/
|
||||
@@ -120,7 +120,7 @@ void ibutton_worker_mode_emulate_stop(iButtonWorker* worker) {
|
||||
|
||||
void ibutton_worker_mode_write_common_start(iButtonWorker* worker) { //-V524
|
||||
UNUSED(worker);
|
||||
furi_hal_power_enable_otg();
|
||||
if(!furi_hal_power_is_otg_enabled()) furi_hal_power_enable_otg();
|
||||
}
|
||||
|
||||
void ibutton_worker_mode_write_id_tick(iButtonWorker* worker) {
|
||||
@@ -149,5 +149,5 @@ void ibutton_worker_mode_write_copy_tick(iButtonWorker* worker) {
|
||||
|
||||
void ibutton_worker_mode_write_common_stop(iButtonWorker* worker) { //-V524
|
||||
UNUSED(worker);
|
||||
furi_hal_power_disable_otg();
|
||||
if(furi_hal_power_is_otg_enabled()) furi_hal_power_disable_otg();
|
||||
}
|
||||
|
||||
@@ -496,8 +496,10 @@ void subghz_protocol_decoder_gangqi_get_string(void* context, FuriString* output
|
||||
(instance->generic.serial & 0xFF);
|
||||
// Returns true if serial is valid
|
||||
bool serial_is_valid =
|
||||
((!(sum_3bytes_serial & 0x3)) &&
|
||||
((0xb2 < sum_3bytes_serial) && (sum_3bytes_serial < 0x1ae)));
|
||||
(((!(sum_3bytes_serial & 0x3)) &&
|
||||
((0xB < sum_3bytes_serial) && (sum_3bytes_serial < 0x141))) &&
|
||||
((((instance->generic.serial >> 16) & 0xFF) == 0x2) ||
|
||||
(((instance->generic.serial >> 16) & 0xFF) == 0x3)));
|
||||
|
||||
furi_string_cat_printf(
|
||||
output,
|
||||
|
||||
Reference in New Issue
Block a user