Skip to content

Commit

Permalink
fix typo, fix difference with ofw
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Apr 11, 2024
1 parent b95887d commit e5c07d3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 31 deletions.
1 change: 0 additions & 1 deletion base_pack/weather_station/helpers/weather_station_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <furi.h>
#include <furi_hal.h>

#define WS_VERSION_APP "1.3"
#define WS_DEVELOPED "SkorP"
#define WS_GITHUB "https://github.com/flipperdevices/flipperzero-good-faps"

Expand Down
28 changes: 14 additions & 14 deletions base_pack/weather_station/protocols/acurite_986.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ void ws_protocol_decoder_acurite_986_reset(void* context) {
static bool ws_protocol_acurite_986_check(WSProtocolDecoderAcurite_986* instance) {
if(!instance->decoder.decode_data) return false;
uint8_t msg[] = {
instance->decoder.decode_data >> 32,
instance->decoder.decode_data >> 24,
instance->decoder.decode_data >> 16,
instance->decoder.decode_data >> 8 };
instance->decoder.decode_data >> 32,
instance->decoder.decode_data >> 24,
instance->decoder.decode_data >> 16,
instance->decoder.decode_data >> 8};

uint8_t crc = subghz_protocol_blocks_crc8(msg, 4, 0x07, 0x00);
return (crc == (instance->decoder.decode_data & 0xFF));
Expand All @@ -122,7 +122,8 @@ static void ws_protocol_acurite_986_remote_controller(WSBlockGeneric* instance)
int temp;

instance->id = subghz_protocol_blocks_reverse_key(instance->data >> 24, 8);
instance->id = (instance->id << 8) | subghz_protocol_blocks_reverse_key(instance->data >> 16, 8);
instance->id = (instance->id << 8) |
subghz_protocol_blocks_reverse_key(instance->data >> 16, 8);
instance->battery_low = (instance->data >> 14) & 1;
instance->channel = ((instance->data >> 15) & 1) + 1;

Expand Down Expand Up @@ -152,7 +153,7 @@ void ws_protocol_decoder_acurite_986_feed(void* context, bool level, uint32_t du

case Acurite_986DecoderStepSync1:
if(DURATION_DIFF(duration, ws_protocol_acurite_986_const.te_long) <
ws_protocol_acurite_986_const.te_delta * 15) {
ws_protocol_acurite_986_const.te_delta * 15) {
if(!level) {
instance->decoder.parser_step = Acurite_986DecoderStepSync2;
}
Expand All @@ -163,7 +164,7 @@ void ws_protocol_decoder_acurite_986_feed(void* context, bool level, uint32_t du

case Acurite_986DecoderStepSync2:
if(DURATION_DIFF(duration, ws_protocol_acurite_986_const.te_long) <
ws_protocol_acurite_986_const.te_delta * 15) {
ws_protocol_acurite_986_const.te_delta * 15) {
if(!level) {
instance->decoder.parser_step = Acurite_986DecoderStepSync3;
}
Expand All @@ -174,7 +175,7 @@ void ws_protocol_decoder_acurite_986_feed(void* context, bool level, uint32_t du

case Acurite_986DecoderStepSync3:
if(DURATION_DIFF(duration, ws_protocol_acurite_986_const.te_long) <
ws_protocol_acurite_986_const.te_delta * 15) {
ws_protocol_acurite_986_const.te_delta * 15) {
if(!level) {
instance->decoder.parser_step = Acurite_986DecoderStepSaveDuration;
}
Expand All @@ -195,7 +196,7 @@ void ws_protocol_decoder_acurite_986_feed(void* context, bool level, uint32_t du
case Acurite_986DecoderStepCheckDuration:
if(!level) {
if(DURATION_DIFF(duration, ws_protocol_acurite_986_const.te_short) <
ws_protocol_acurite_986_const.te_delta * 10) {
ws_protocol_acurite_986_const.te_delta * 10) {
if(duration < ws_protocol_acurite_986_const.te_short) {
subghz_protocol_blocks_add_bit(&instance->decoder, 0);
instance->decoder.parser_step = Acurite_986DecoderStepSaveDuration;
Expand All @@ -206,8 +207,9 @@ void ws_protocol_decoder_acurite_986_feed(void* context, bool level, uint32_t du
} else {
//Found syncPostfix
instance->decoder.parser_step = Acurite_986DecoderStepReset;
if((instance->decoder.decode_count_bit == ws_protocol_acurite_986_const.min_count_bit_for_found) &&
ws_protocol_acurite_986_check(instance)) {
if((instance->decoder.decode_count_bit ==
ws_protocol_acurite_986_const.min_count_bit_for_found) &&
ws_protocol_acurite_986_check(instance)) {
instance->generic.data = instance->decoder.decode_data;
instance->generic.data_count_bit = instance->decoder.decode_count_bit;
ws_protocol_acurite_986_remote_controller(&instance->generic);
Expand Down Expand Up @@ -245,9 +247,7 @@ SubGhzProtocolStatus
furi_assert(context);
WSProtocolDecoderAcurite_986* instance = context;
return ws_block_generic_deserialize_check_count_bit(
&instance->generic,
flipper_format,
ws_protocol_acurite_986_const.min_count_bit_for_found);
&instance->generic, flipper_format, ws_protocol_acurite_986_const.min_count_bit_for_found);
}

void ws_protocol_decoder_acurite_986_get_string(void* context, FuriString* output) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void weather_station_scene_about_on_enter(void* context) {
temp_str = furi_string_alloc();
furi_string_printf(temp_str, "\e#%s\n", "Information");

furi_string_cat_printf(temp_str, "Version: %s\n", WS_VERSION_APP);
furi_string_cat_printf(temp_str, "Version: %s\n", FAP_VERSION);
furi_string_cat_printf(temp_str, "Developed by: %s\n", WS_DEVELOPED);
furi_string_cat_printf(temp_str, "Github: %s\n\n", WS_GITHUB);

Expand Down
12 changes: 5 additions & 7 deletions base_pack/weather_station/views/weather_station_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ typedef struct {
uint16_t history_item;
WSReceiverBarShow bar_show;
uint8_t u_rssi;
bool external_redio;
bool external_radio;
} WSReceiverModel;

void ws_view_receiver_set_rssi(WSReceiver* instance, float rssi) {
Expand Down Expand Up @@ -165,7 +165,7 @@ void ws_view_receiver_add_data_statusbar(
furi_string_set_str(model->frequency_str, frequency_str);
furi_string_set_str(model->preset_str, preset_str);
furi_string_set_str(model->history_stat_str, history_stat_str);
model->external_redio = external;
model->external_radio = external;
},
true);
}
Expand Down Expand Up @@ -205,8 +205,6 @@ void ws_view_receiver_draw(Canvas* canvas, WSReceiverModel* model) {
FuriString* str_buff;
str_buff = furi_string_alloc();

// bool ext_module = furi_hal_subghz_get_radio_type();

WSReceiverMenuItem* item_menu;

for(size_t i = 0; i < MIN(model->history_item, MENU_ITEMS); ++i) {
Expand All @@ -232,11 +230,11 @@ void ws_view_receiver_draw(Canvas* canvas, WSReceiverModel* model) {

if(model->history_item == 0) {
canvas_draw_icon(
canvas, 0, 0, model->external_redio ? &I_Fishing_123x52 : &I_Scanning_123x52);
canvas, 0, 0, model->external_radio ? &I_Fishing_123x52 : &I_Scanning_123x52);
canvas_set_font(canvas, FontPrimary);
canvas_draw_str(canvas, 63, 46, "Scanning...");
canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas, 44, 10, model->external_redio ? "Ext" : "Int");
canvas_draw_str(canvas, 44, 10, model->external_radio ? "Ext" : "Int");
}

// Draw RSSI
Expand Down Expand Up @@ -412,7 +410,7 @@ WSReceiver* ws_view_receiver_alloc() {
model->history_stat_str = furi_string_alloc();
model->bar_show = WSReceiverBarShowDefault;
model->history = malloc(sizeof(WSReceiverHistory));
model->external_redio = false;
model->external_radio = false;
WSReceiverMenuItemArray_init(model->history->data);
},
true);
Expand Down
10 changes: 2 additions & 8 deletions base_pack/weather_station/views/weather_station_receiver_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ void ws_view_receiver_info_update(WSReceiverInfo* ws_receiver_info, FlipperForma

ws_block_generic_deserialize(model->generic, fff);

DateTime curr_dt;
furi_hal_rtc_get_datetime(&curr_dt);
model->curr_ts = datetime_datetime_to_timestamp(&curr_dt);
model->curr_ts = furi_hal_rtc_get_timestamp();
},
true);
}
Expand Down Expand Up @@ -185,11 +183,7 @@ static void ws_view_receiver_info_timer(void* context) {
with_view_model(
ws_receiver_info->view,
WSReceiverInfoModel * model,
{
DateTime curr_dt;
furi_hal_rtc_get_datetime(&curr_dt);
model->curr_ts = datetime_datetime_to_timestamp(&curr_dt);
},
{ model->curr_ts = furi_hal_rtc_get_timestamp(); },
true);
}

Expand Down

0 comments on commit e5c07d3

Please sign in to comment.