Skip to content

Commit

Permalink
Merge pull request #3 from leedave/feature/fix_for_0.99.0
Browse files Browse the repository at this point in the history
Update for 0.99.0-rc
  • Loading branch information
leedave authored Mar 5, 2024
2 parents 37dd3bd + b96f650 commit 82997e4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 21 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.4
- Prevent value changing on win view
- Fix issues with FW build 0.99.x

## 1.3
- Patched Memory Leak in storage

Expand Down
51 changes: 30 additions & 21 deletions views/color_guess_play.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <input/input.h>
#include <gui/elements.h>
#include <dolphin/dolphin.h>
#include <datetime/datetime.h>

struct ColorGuessPlay {
View* view;
Expand Down Expand Up @@ -53,9 +54,9 @@ void color_guess_play_new_round(void* context, ColorGuessPlayModel* model) {
furi_assert(context);
ColorGuess* app = context;
//Reset timer
FuriHalRtcDateTime date_time;
DateTime date_time;
furi_hal_rtc_get_datetime(&date_time);
model->timestamp_start = furi_hal_rtc_datetime_to_timestamp(&date_time);
model->timestamp_start = datetime_datetime_to_timestamp(&date_time);
model->success = 0;
model->closeness = 0;
model->prev_closeness = 0;
Expand Down Expand Up @@ -152,9 +153,9 @@ void color_guess_play_draw(Canvas* canvas, ColorGuessPlayModel* model) {
}
const int cursorOffset = 30;
const int newCursorPos = (model->cursorpos * 12) + cursorOffset;
FuriHalRtcDateTime date_time;
DateTime date_time;
furi_hal_rtc_get_datetime(&date_time);
uint32_t timestamp = furi_hal_rtc_datetime_to_timestamp(&date_time);
uint32_t timestamp = datetime_datetime_to_timestamp(&date_time);
uint32_t time_elapsed = timestamp - model->timestamp_start;
model->time_spent = time_elapsed;

Expand Down Expand Up @@ -213,9 +214,11 @@ bool color_guess_play_input(InputEvent* event, void* context) {
instance->view,
ColorGuessPlayModel * model,
{
model->cursorpos--;
if(model->cursorpos < 0) {
model->cursorpos = 5;
if(model->success != 1) {
model->cursorpos--;
if(model->cursorpos < 0) {
model->cursorpos = 5;
}
}
},
true);
Expand All @@ -225,9 +228,11 @@ bool color_guess_play_input(InputEvent* event, void* context) {
instance->view,
ColorGuessPlayModel * model,
{
model->cursorpos++;
if(model->cursorpos > 5) {
model->cursorpos = 0;
if(model->success != 1) {
model->cursorpos++;
if(model->cursorpos > 5) {
model->cursorpos = 0;
}
}
},
true);
Expand All @@ -237,12 +242,14 @@ bool color_guess_play_input(InputEvent* event, void* context) {
instance->view,
ColorGuessPlayModel * model,
{
model->digit[model->cursorpos]++;
if(model->digit[model->cursorpos] > 15) {
model->digit[model->cursorpos] = 0;
if(model->success != 1) {
model->digit[model->cursorpos]++;
if(model->digit[model->cursorpos] > 15) {
model->digit[model->cursorpos] = 0;
}
color_guess_play_calculate_closeness(instance, model);
play_haptic(instance->context, model);
}
color_guess_play_calculate_closeness(instance, model);
play_haptic(instance->context, model);
},
true);
break;
Expand All @@ -251,12 +258,14 @@ bool color_guess_play_input(InputEvent* event, void* context) {
instance->view,
ColorGuessPlayModel * model,
{
model->digit[model->cursorpos]--;
if(model->digit[model->cursorpos] < 0) {
model->digit[model->cursorpos] = 15;
if(model->success != 1) {
model->digit[model->cursorpos]--;
if(model->digit[model->cursorpos] < 0) {
model->digit[model->cursorpos] = 15;
}
color_guess_play_calculate_closeness(instance, model);
play_haptic(instance->context, model);
}
color_guess_play_calculate_closeness(instance, model);
play_haptic(instance->context, model);
},
true);
break;
Expand Down Expand Up @@ -322,7 +331,7 @@ void color_guess_play_free(ColorGuessPlay* instance) {
furi_assert(instance);

with_view_model(
instance->view, ColorGuessPlayModel * model, { free(model->digit); }, true);
instance->view, ColorGuessPlayModel * model, { free(model); }, true);
view_free(instance->view);
free(instance);
}
Expand Down

0 comments on commit 82997e4

Please sign in to comment.