mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-18 00:38:10 -07:00
Merge branch 'ofw-dev' into dev
This commit is contained in:
@@ -892,7 +892,7 @@ ELFFileLoadStatus elf_file_load_sections(ELFFile* elf) {
|
||||
ELFSectionDict_itref_t* itref = ELFSectionDict_ref(it);
|
||||
total_size += itref->value.size;
|
||||
}
|
||||
FURI_LOG_I(TAG, "Total size of loaded sections: %u", total_size); //-V576
|
||||
FURI_LOG_I(TAG, "Total size of loaded sections: %zu", total_size);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
@@ -325,7 +325,7 @@ void protocol_fdx_b_render_brief_data(ProtocolFDXB* protocol, FuriString* result
|
||||
float temperature;
|
||||
if(protocol_fdx_b_get_temp(protocol->data, &temperature)) {
|
||||
if(furi_hal_rtc_get_locale_units() == FuriHalRtcLocaleUnitsMetric) {
|
||||
float temperature_c = (temperature - 32) / 1.8;
|
||||
float temperature_c = (temperature - 32.0f) / 1.8f;
|
||||
furi_string_cat_printf(result, "T: %.2fC", (double)temperature_c);
|
||||
} else {
|
||||
furi_string_cat_printf(result, "T: %.2fF", (double)temperature);
|
||||
|
||||
@@ -244,7 +244,9 @@ bool subghz_file_encoder_worker_start(
|
||||
|
||||
furi_stream_buffer_reset(instance->stream);
|
||||
furi_string_set(instance->file_path, file_path);
|
||||
instance->device = subghz_devices_get_by_name(radio_device_name);
|
||||
if(radio_device_name) {
|
||||
instance->device = subghz_devices_get_by_name(radio_device_name);
|
||||
}
|
||||
instance->worker_running = true;
|
||||
furi_thread_start(instance->thread);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ env.Append(
|
||||
SDK_HEADERS=[
|
||||
File("api_lock.h"),
|
||||
File("value_index.h"),
|
||||
File("compress.h"),
|
||||
File("manchester_decoder.h"),
|
||||
File("manchester_encoder.h"),
|
||||
File("path.h"),
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#include "md5.h"
|
||||
#include "md5_calc.h"
|
||||
|
||||
bool md5_calc_file(File* file, const char* path, unsigned char output[16], FS_Error* file_error) {
|
||||
bool result = storage_file_open(file, path, FSAM_READ, FSOM_OPEN_EXISTING);
|
||||
|
||||
if(result) {
|
||||
const uint16_t size_to_read = 512;
|
||||
uint8_t* data = malloc(size_to_read);
|
||||
md5_context* md5_ctx = malloc(sizeof(md5_context));
|
||||
|
||||
md5_starts(md5_ctx);
|
||||
while(true) {
|
||||
uint16_t read_size = storage_file_read(file, data, size_to_read);
|
||||
if(read_size == 0) break;
|
||||
md5_update(md5_ctx, data, read_size);
|
||||
}
|
||||
md5_finish(md5_ctx, output);
|
||||
free(md5_ctx);
|
||||
free(data);
|
||||
}
|
||||
|
||||
if(file_error != NULL) {
|
||||
*file_error = storage_file_get_error(file);
|
||||
}
|
||||
|
||||
storage_file_close(file);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool md5_string_calc_file(File* file, const char* path, FuriString* output, FS_Error* file_error) {
|
||||
const size_t hash_size = 16;
|
||||
unsigned char hash[hash_size];
|
||||
bool result = md5_calc_file(file, path, hash, file_error);
|
||||
|
||||
if(result) {
|
||||
furi_string_set(output, "");
|
||||
for(size_t i = 0; i < hash_size; i++) {
|
||||
furi_string_cat_printf(output, "%02x", hash[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool md5_calc_file(File* file, const char* path, unsigned char output[16], FS_Error* file_error);
|
||||
|
||||
bool md5_string_calc_file(File* file, const char* path, FuriString* output, FS_Error* file_error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user