mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-17 04:34:44 -07:00
Merge (Dev Commits)[https://github.com/flipperdevices/flipperzero-firmware/commits/dev]
This commit is contained in:
@@ -21,8 +21,8 @@ static void locale_test_view_draw_callback(Canvas* canvas, void* _model) {
|
||||
FuriString* tmp_string = furi_string_alloc();
|
||||
|
||||
float temp = 25.3f;
|
||||
LocaleMeasurementUnit units = locale_get_measurement_unit();
|
||||
if(units == LocaleMeasurementUnitMetric) {
|
||||
LocaleMeasurementUnits units = locale_get_measurement_unit();
|
||||
if(units == LocaleMeasurementUnitsMetric) {
|
||||
furi_string_printf(tmp_string, "Temp: %5.1fC", (double)temp);
|
||||
} else {
|
||||
temp = locale_celsius_to_fahrenheit(temp);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB |
@@ -2,28 +2,28 @@
|
||||
|
||||
#define TAG "LocaleSrv"
|
||||
|
||||
LocaleMeasurementUnit locale_get_measurement_unit(void) {
|
||||
return furi_hal_rtc_get_locale_units();
|
||||
LocaleMeasurementUnits locale_get_measurement_unit(void) {
|
||||
return (LocaleMeasurementUnits)furi_hal_rtc_get_locale_units();
|
||||
}
|
||||
|
||||
void locale_set_measurement_unit(LocaleMeasurementUnit format) {
|
||||
furi_hal_rtc_set_locale_units(format);
|
||||
void locale_set_measurement_unit(LocaleMeasurementUnits format) {
|
||||
furi_hal_rtc_set_locale_units((FuriHalRtcLocaleUnits)format);
|
||||
}
|
||||
|
||||
LocaleTimeFormat locale_get_time_format(void) {
|
||||
return furi_hal_rtc_get_locale_timeformat();
|
||||
return (LocaleTimeFormat)furi_hal_rtc_get_locale_timeformat();
|
||||
}
|
||||
|
||||
void locale_set_time_format(LocaleTimeFormat format) {
|
||||
furi_hal_rtc_set_locale_timeformat(format);
|
||||
furi_hal_rtc_set_locale_timeformat((FuriHalRtcLocaleTimeFormat)format);
|
||||
}
|
||||
|
||||
LocaleDateFormat locale_get_date_format(void) {
|
||||
return furi_hal_rtc_get_locale_dateformat();
|
||||
return (LocaleDateFormat)furi_hal_rtc_get_locale_dateformat();
|
||||
}
|
||||
|
||||
void locale_set_date_format(LocaleDateFormat format) {
|
||||
furi_hal_rtc_set_locale_dateformat(format);
|
||||
furi_hal_rtc_set_locale_dateformat((FuriHalRtcLocaleDateFormat)format);
|
||||
}
|
||||
|
||||
float locale_fahrenheit_to_celsius(float temp_f) {
|
||||
@@ -36,9 +36,9 @@ float locale_celsius_to_fahrenheit(float temp_c) {
|
||||
|
||||
void locale_format_time(
|
||||
FuriString* out_str,
|
||||
FuriHalRtcDateTime* datetime,
|
||||
LocaleTimeFormat format,
|
||||
bool show_seconds) {
|
||||
const FuriHalRtcDateTime* datetime,
|
||||
const LocaleTimeFormat format,
|
||||
const bool show_seconds) {
|
||||
furi_assert(out_str);
|
||||
furi_assert(datetime);
|
||||
|
||||
@@ -66,9 +66,9 @@ void locale_format_time(
|
||||
|
||||
void locale_format_date(
|
||||
FuriString* out_str,
|
||||
FuriHalRtcDateTime* datetime,
|
||||
LocaleDateFormat format,
|
||||
char* separator) {
|
||||
const FuriHalRtcDateTime* datetime,
|
||||
const LocaleDateFormat format,
|
||||
const char* separator) {
|
||||
furi_assert(out_str);
|
||||
furi_assert(datetime);
|
||||
furi_assert(separator);
|
||||
|
||||
@@ -9,44 +9,98 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
LocaleMeasurementUnitMetric = 0, /**< Meric mesurement units */
|
||||
LocaleMeasurementUnitImperial, /**< Imperial mesurement units */
|
||||
} LocaleMeasurementUnit;
|
||||
LocaleMeasurementUnitsMetric = 0, /**< Metric measurement units */
|
||||
LocaleMeasurementUnitsImperial = 1, /**< Imperial measurement units */
|
||||
} LocaleMeasurementUnits;
|
||||
|
||||
typedef enum {
|
||||
LocaleTimeFormat24h = 0, /**< 24-hour format */
|
||||
LocaleTimeFormat12h, /**< 12-hour format */
|
||||
LocaleTimeFormat12h = 1, /**< 12-hour format */
|
||||
} LocaleTimeFormat;
|
||||
|
||||
typedef enum {
|
||||
LocaleDateFormatDMY = 0, /**< Day/Month/Year */
|
||||
LocaleDateFormatMDY, /**< Month/Day/Year */
|
||||
LocaleDateFormatYMD, /**< Year/Month/Day */
|
||||
LocaleDateFormatMDY = 1, /**< Month/Day/Year */
|
||||
LocaleDateFormatYMD = 2, /**< Year/Month/Day */
|
||||
} LocaleDateFormat;
|
||||
|
||||
LocaleMeasurementUnit locale_get_measurement_unit(void);
|
||||
void locale_set_measurement_unit(LocaleMeasurementUnit format);
|
||||
/** Get Locale measurement units
|
||||
*
|
||||
* @return The locale measurement units.
|
||||
*/
|
||||
LocaleMeasurementUnits locale_get_measurement_unit();
|
||||
|
||||
/** Set locale measurement units
|
||||
*
|
||||
* @param[in] format The locale measurements units
|
||||
*/
|
||||
void locale_set_measurement_unit(LocaleMeasurementUnits format);
|
||||
|
||||
/** Convert Fahrenheit to Celsius
|
||||
*
|
||||
* @param[in] temp_f The Temperature in Fahrenheit
|
||||
*
|
||||
* @return The Temperature in Celsius
|
||||
*/
|
||||
float locale_fahrenheit_to_celsius(float temp_f);
|
||||
|
||||
/** Convert Celsius to Fahrenheit
|
||||
*
|
||||
* @param[in] temp_c The Temperature in Celsius
|
||||
*
|
||||
* @return The Temperature in Fahrenheit
|
||||
*/
|
||||
float locale_celsius_to_fahrenheit(float temp_c);
|
||||
|
||||
LocaleTimeFormat locale_get_time_format(void);
|
||||
/** Get Locale time format
|
||||
*
|
||||
* @return The locale time format.
|
||||
*/
|
||||
LocaleTimeFormat locale_get_time_format();
|
||||
|
||||
/** Set Locale Time Format
|
||||
*
|
||||
* @param[in] format The Locale Time Format
|
||||
*/
|
||||
void locale_set_time_format(LocaleTimeFormat format);
|
||||
|
||||
/** Format time to furi string
|
||||
*
|
||||
* @param[out] out_str The FuriString to store formatted time
|
||||
* @param[in] datetime Pointer to the datetime
|
||||
* @param[in] format The Locale Time Format
|
||||
* @param[in] show_seconds The show seconds flag
|
||||
*/
|
||||
void locale_format_time(
|
||||
FuriString* out_str,
|
||||
FuriHalRtcDateTime* datetime,
|
||||
LocaleTimeFormat format,
|
||||
bool show_seconds);
|
||||
const FuriHalRtcDateTime* datetime,
|
||||
const LocaleTimeFormat format,
|
||||
const bool show_seconds);
|
||||
|
||||
LocaleDateFormat locale_get_date_format(void);
|
||||
/** Get Locale DateFormat
|
||||
*
|
||||
* @return The Locale DateFormat.
|
||||
*/
|
||||
LocaleDateFormat locale_get_date_format();
|
||||
|
||||
/** Set Locale DateFormat
|
||||
*
|
||||
* @param[in] format The Locale DateFormat
|
||||
*/
|
||||
void locale_set_date_format(LocaleDateFormat format);
|
||||
|
||||
/** Format date to furi string
|
||||
*
|
||||
* @param[out] out_str The FuriString to store formatted date
|
||||
* @param[in] datetime Pointer to the datetime
|
||||
* @param[in] format The format
|
||||
* @param[in] separator The separator
|
||||
*/
|
||||
void locale_format_date(
|
||||
FuriString* out_str,
|
||||
FuriHalRtcDateTime* datetime,
|
||||
LocaleDateFormat format,
|
||||
char* separator);
|
||||
const FuriHalRtcDateTime* datetime,
|
||||
const LocaleDateFormat format,
|
||||
const char* separator);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ void notification_vibro_off() {
|
||||
}
|
||||
|
||||
void notification_sound_on(float freq, float volume) {
|
||||
if(furi_hal_speaker_acquire(30)) {
|
||||
if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) {
|
||||
furi_hal_speaker_start(freq, volume);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,8 +77,8 @@ const char* const mesurement_units_text[] = {
|
||||
};
|
||||
|
||||
const uint32_t mesurement_units_value[] = {
|
||||
LocaleMeasurementUnitMetric,
|
||||
LocaleMeasurementUnitImperial,
|
||||
LocaleMeasurementUnitsMetric,
|
||||
LocaleMeasurementUnitsImperial,
|
||||
};
|
||||
|
||||
static void mesurement_units_changed(VariableItem* item) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
entry,status,name,type,params
|
||||
Version,+,12.0,,
|
||||
Version,v,12.1,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/cli/cli.h,,
|
||||
Header,+,applications/services/cli/cli_vcp.h,,
|
||||
@@ -1295,6 +1295,9 @@ Function,+,furi_hal_rtc_get_boot_mode,FuriHalRtcBootMode,
|
||||
Function,+,furi_hal_rtc_get_datetime,void,FuriHalRtcDateTime*
|
||||
Function,+,furi_hal_rtc_get_fault_data,uint32_t,
|
||||
Function,+,furi_hal_rtc_get_heap_track_mode,FuriHalRtcHeapTrackMode,
|
||||
Function,?,furi_hal_rtc_get_locale_dateformat,FuriHalRtcLocaleDateFormat,
|
||||
Function,?,furi_hal_rtc_get_locale_timeformat,FuriHalRtcLocaleTimeFormat,
|
||||
Function,?,furi_hal_rtc_get_locale_units,FuriHalRtcLocaleUnits,
|
||||
Function,+,furi_hal_rtc_get_log_level,uint8_t,
|
||||
Function,+,furi_hal_rtc_get_pin_fails,uint32_t,
|
||||
Function,+,furi_hal_rtc_get_register,uint32_t,FuriHalRtcRegister
|
||||
@@ -1308,6 +1311,9 @@ Function,+,furi_hal_rtc_set_datetime,void,FuriHalRtcDateTime*
|
||||
Function,+,furi_hal_rtc_set_fault_data,void,uint32_t
|
||||
Function,+,furi_hal_rtc_set_flag,void,FuriHalRtcFlag
|
||||
Function,+,furi_hal_rtc_set_heap_track_mode,void,FuriHalRtcHeapTrackMode
|
||||
Function,+,furi_hal_rtc_set_locale_dateformat,void,FuriHalRtcLocaleDateFormat
|
||||
Function,+,furi_hal_rtc_set_locale_timeformat,void,FuriHalRtcLocaleTimeFormat
|
||||
Function,+,furi_hal_rtc_set_locale_units,void,FuriHalRtcLocaleUnits
|
||||
Function,+,furi_hal_rtc_set_log_level,void,uint8_t
|
||||
Function,+,furi_hal_rtc_set_pin_fails,void,uint32_t
|
||||
Function,+,furi_hal_rtc_set_register,void,"FuriHalRtcRegister, uint32_t"
|
||||
@@ -1775,13 +1781,13 @@ Function,+,loading_free,void,Loading*
|
||||
Function,+,loading_get_view,View*,Loading*
|
||||
Function,+,locale_celsius_to_fahrenheit,float,float
|
||||
Function,+,locale_fahrenheit_to_celsius,float,float
|
||||
Function,+,locale_format_date,void,"FuriString*, FuriHalRtcDateTime*, LocaleDateFormat, char*"
|
||||
Function,+,locale_format_time,void,"FuriString*, FuriHalRtcDateTime*, LocaleTimeFormat, _Bool"
|
||||
Function,+,locale_format_date,void,"FuriString*, const FuriHalRtcDateTime*, const LocaleDateFormat, const char*"
|
||||
Function,+,locale_format_time,void,"FuriString*, const FuriHalRtcDateTime*, const LocaleTimeFormat, const _Bool"
|
||||
Function,+,locale_get_date_format,LocaleDateFormat,
|
||||
Function,+,locale_get_measurement_unit,LocaleMeasurementUnit,
|
||||
Function,+,locale_get_measurement_unit,LocaleMeasurementUnits,
|
||||
Function,+,locale_get_time_format,LocaleTimeFormat,
|
||||
Function,+,locale_set_date_format,void,LocaleDateFormat
|
||||
Function,+,locale_set_measurement_unit,void,LocaleMeasurementUnit
|
||||
Function,+,locale_set_measurement_unit,void,LocaleMeasurementUnits
|
||||
Function,+,locale_set_time_format,void,LocaleTimeFormat
|
||||
Function,-,localtime,tm*,const time_t*
|
||||
Function,-,localtime_r,tm*,"const time_t*, tm*"
|
||||
|
||||
|
@@ -29,11 +29,11 @@ typedef struct {
|
||||
uint8_t log_level : 4;
|
||||
uint8_t log_reserved : 4;
|
||||
uint8_t flags;
|
||||
uint8_t boot_mode : 4;
|
||||
uint8_t heap_track_mode : 2;
|
||||
uint8_t locale_units : 1;
|
||||
uint8_t locale_timeformat : 1;
|
||||
uint8_t locale_dateformat : 2;
|
||||
FuriHalRtcBootMode boot_mode : 4;
|
||||
FuriHalRtcHeapTrackMode heap_track_mode : 2;
|
||||
FuriHalRtcLocaleUnits locale_units : 1;
|
||||
FuriHalRtcLocaleTimeFormat locale_timeformat : 1;
|
||||
FuriHalRtcLocaleDateFormat locale_dateformat : 2;
|
||||
uint8_t reserved : 6;
|
||||
} SystemReg;
|
||||
|
||||
@@ -225,7 +225,7 @@ void furi_hal_rtc_set_boot_mode(FuriHalRtcBootMode mode) {
|
||||
FuriHalRtcBootMode furi_hal_rtc_get_boot_mode() {
|
||||
uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem);
|
||||
SystemReg* data = (SystemReg*)&data_reg;
|
||||
return (FuriHalRtcBootMode)data->boot_mode;
|
||||
return data->boot_mode;
|
||||
}
|
||||
|
||||
void furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackMode mode) {
|
||||
@@ -238,47 +238,48 @@ void furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackMode mode) {
|
||||
FuriHalRtcHeapTrackMode furi_hal_rtc_get_heap_track_mode() {
|
||||
uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem);
|
||||
SystemReg* data = (SystemReg*)&data_reg;
|
||||
return (FuriHalRtcHeapTrackMode)data->heap_track_mode;
|
||||
return data->heap_track_mode;
|
||||
}
|
||||
|
||||
void furi_hal_rtc_set_locale_units(uint8_t mode) {
|
||||
void furi_hal_rtc_set_locale_units(FuriHalRtcLocaleUnits value) {
|
||||
uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem);
|
||||
SystemReg* data = (SystemReg*)&data_reg;
|
||||
data->locale_units = mode;
|
||||
data->locale_units = value;
|
||||
furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg);
|
||||
}
|
||||
|
||||
uint8_t furi_hal_rtc_get_locale_units() {
|
||||
FuriHalRtcLocaleUnits furi_hal_rtc_get_locale_units() {
|
||||
uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem);
|
||||
SystemReg* data = (SystemReg*)&data_reg;
|
||||
return (uint8_t)data->locale_units;
|
||||
return data->locale_units;
|
||||
}
|
||||
|
||||
void furi_hal_rtc_set_locale_timeformat(uint8_t mode) {
|
||||
void furi_hal_rtc_set_locale_timeformat(FuriHalRtcLocaleTimeFormat value) {
|
||||
uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem);
|
||||
SystemReg* data = (SystemReg*)&data_reg;
|
||||
data->locale_timeformat = mode;
|
||||
data->locale_timeformat = value;
|
||||
furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg);
|
||||
}
|
||||
|
||||
uint8_t furi_hal_rtc_get_locale_timeformat() {
|
||||
FuriHalRtcLocaleTimeFormat furi_hal_rtc_get_locale_timeformat() {
|
||||
uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem);
|
||||
SystemReg* data = (SystemReg*)&data_reg;
|
||||
return (uint8_t)data->locale_timeformat;
|
||||
return data->locale_timeformat;
|
||||
}
|
||||
|
||||
void furi_hal_rtc_set_locale_dateformat(uint8_t mode) {
|
||||
void furi_hal_rtc_set_locale_dateformat(FuriHalRtcLocaleDateFormat value) {
|
||||
uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem);
|
||||
SystemReg* data = (SystemReg*)&data_reg;
|
||||
data->locale_dateformat = mode;
|
||||
data->locale_dateformat = value;
|
||||
furi_hal_rtc_set_register(FuriHalRtcRegisterSystem, data_reg);
|
||||
}
|
||||
|
||||
uint8_t furi_hal_rtc_get_locale_dateformat() {
|
||||
FuriHalRtcLocaleDateFormat furi_hal_rtc_get_locale_dateformat() {
|
||||
uint32_t data_reg = furi_hal_rtc_get_register(FuriHalRtcRegisterSystem);
|
||||
SystemReg* data = (SystemReg*)&data_reg;
|
||||
return (uint8_t)data->locale_dateformat;
|
||||
return data->locale_dateformat;
|
||||
}
|
||||
|
||||
void furi_hal_rtc_set_datetime(FuriHalRtcDateTime* datetime) {
|
||||
furi_assert(datetime);
|
||||
|
||||
|
||||
@@ -59,6 +59,22 @@ typedef enum {
|
||||
FuriHalRtcRegisterMAX, /**< Service value, do not use */
|
||||
} FuriHalRtcRegister;
|
||||
|
||||
typedef enum {
|
||||
FuriHalRtcLocaleUnitsMetric = 0, /**< Metric measurement units */
|
||||
FuriHalRtcLocaleUnitsImperial = 1, /**< Imperial measurement units */
|
||||
} FuriHalRtcLocaleUnits;
|
||||
|
||||
typedef enum {
|
||||
FuriHalRtcLocaleTimeFormat24h = 0, /**< 24-hour format */
|
||||
FuriHalRtcLocaleTimeFormat12h = 1, /**< 12-hour format */
|
||||
} FuriHalRtcLocaleTimeFormat;
|
||||
|
||||
typedef enum {
|
||||
FuriHalRtcLocaleDateFormatDMY = 0, /**< Day/Month/Year */
|
||||
FuriHalRtcLocaleDateFormatMDY = 1, /**< Month/Day/Year */
|
||||
FuriHalRtcLocaleDateFormatYMD = 2, /**< Year/Month/Day */
|
||||
} FuriHalRtcLocaleDateFormat;
|
||||
|
||||
/** Early initialization */
|
||||
void furi_hal_rtc_init_early();
|
||||
|
||||
@@ -90,6 +106,47 @@ void furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackMode mode);
|
||||
|
||||
FuriHalRtcHeapTrackMode furi_hal_rtc_get_heap_track_mode();
|
||||
|
||||
/** Set locale units
|
||||
*
|
||||
* @param[in] mode The RTC Locale Units
|
||||
*/
|
||||
void furi_hal_rtc_set_locale_units(FuriHalRtcLocaleUnits value);
|
||||
|
||||
/** Get RTC Locale Units
|
||||
*
|
||||
* @return The RTC Locale Units.
|
||||
*/
|
||||
FuriHalRtcLocaleUnits furi_hal_rtc_get_locale_units();
|
||||
|
||||
/** Set RTC Locale Time Format
|
||||
*
|
||||
* @param[in] value The RTC Locale Time Format
|
||||
*/
|
||||
void furi_hal_rtc_set_locale_timeformat(FuriHalRtcLocaleTimeFormat value);
|
||||
|
||||
/** Get RTC Locale Time Format
|
||||
*
|
||||
* @return The RTC Locale Time Format.
|
||||
*/
|
||||
FuriHalRtcLocaleTimeFormat furi_hal_rtc_get_locale_timeformat();
|
||||
|
||||
/** Set RTC Locale Date Format
|
||||
*
|
||||
* @param[in] value The RTC Locale Date Format
|
||||
*/
|
||||
void furi_hal_rtc_set_locale_dateformat(FuriHalRtcLocaleDateFormat value);
|
||||
|
||||
/** Get RTC Locale Date Format
|
||||
*
|
||||
* @return The RTC Locale Date Format
|
||||
*/
|
||||
FuriHalRtcLocaleDateFormat furi_hal_rtc_get_locale_dateformat();
|
||||
|
||||
/** Set RTC Date Time
|
||||
*
|
||||
* @param datetime The date time to set
|
||||
*/
|
||||
|
||||
void furi_hal_rtc_set_datetime(FuriHalRtcDateTime* datetime);
|
||||
|
||||
void furi_hal_rtc_get_datetime(FuriHalRtcDateTime* datetime);
|
||||
|
||||
@@ -167,6 +167,7 @@ def prepare_app_metadata(target, source, env):
|
||||
sdk_cache = SdkCache(env["SDK_DEFINITION"].path, load_version_only=True)
|
||||
|
||||
if not sdk_cache.is_buildable():
|
||||
print(target, source, env)
|
||||
raise UserError(
|
||||
"SDK version is not finalized, please review changes and re-run operation"
|
||||
)
|
||||
|
||||
@@ -219,9 +219,7 @@ def gen_sdk_data(sdk_cache: SdkCache):
|
||||
|
||||
def _check_sdk_is_up2date(sdk_cache: SdkCache):
|
||||
if not sdk_cache.is_buildable():
|
||||
raise UserError(
|
||||
"SDK version is not finalized, please review changes and re-run operation"
|
||||
)
|
||||
print("Working with WIP SDK. Expect failures")
|
||||
|
||||
|
||||
def validate_sdk_cache(source, target, env):
|
||||
|
||||
@@ -24,7 +24,7 @@ def flp_serial_by_name(flp_name):
|
||||
return ""
|
||||
|
||||
|
||||
UPDATE_TIMEOUT = 30
|
||||
UPDATE_TIMEOUT = 60
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in New Issue
Block a user