mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
[FL-3774] Fix 5V on GPIO (#4103)
* Move OTG controls to the power service * Accessor: add missing power service import * Power: add is_otg_enabled to info and properly handle OTG enable with VBUS voltage present * Power: method naming * Power: add backward compatibility with old-style use of furi_hal_power * Scripts: lower MIN_GAP_PAGES to 1 * SubGhz: fix incorrect logging tag * SubGhz: delegate OTG management to power service * Power: fix condition race, various improvements Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -28,22 +28,15 @@
|
||||
#define TAG "SubGhzCli"
|
||||
|
||||
static void subghz_cli_radio_device_power_on(void) {
|
||||
uint8_t attempts = 5;
|
||||
while(--attempts > 0) {
|
||||
if(furi_hal_power_enable_otg()) break;
|
||||
}
|
||||
if(attempts == 0) {
|
||||
if(furi_hal_power_get_usb_voltage() < 4.5f) {
|
||||
FURI_LOG_E(
|
||||
"TAG",
|
||||
"Error power otg enable. BQ2589 check otg fault = %d",
|
||||
furi_hal_power_check_otg_fault() ? 1 : 0);
|
||||
}
|
||||
}
|
||||
Power* power = furi_record_open(RECORD_POWER);
|
||||
power_enable_otg(power, true);
|
||||
furi_record_close(RECORD_POWER);
|
||||
}
|
||||
|
||||
static void subghz_cli_radio_device_power_off(void) {
|
||||
if(furi_hal_power_is_otg_enabled()) furi_hal_power_disable_otg();
|
||||
Power* power = furi_record_open(RECORD_POWER);
|
||||
power_enable_otg(power, false);
|
||||
furi_record_close(RECORD_POWER);
|
||||
}
|
||||
|
||||
static SubGhzEnvironment* subghz_cli_environment_init(void) {
|
||||
|
||||
Reference in New Issue
Block a user