@@ -86,6 +86,8 @@ void showVer (Canvas* const canvas)
86
86
show (canvas , 4 ,59 , VER_MAJ , SHOW_SET_BLK );
87
87
canvas_draw_frame (canvas , 8 ,62 , 2 ,2 );
88
88
show (canvas , 11 ,59 , VER_MIN , SHOW_SET_BLK );
89
+ canvas_draw_frame (canvas , 15 ,62 , 2 ,2 );
90
+ show (canvas , 18 ,59 , VER_SUB , SHOW_SET_BLK );
89
91
}
90
92
91
93
//+============================================================================
@@ -102,10 +104,10 @@ void cbDraw (Canvas* const canvas, void* ctx)
102
104
furi_assert (canvas );
103
105
furi_assert (ctx );
104
106
105
- state_t * state = NULL ;
107
+ state_t * state = ctx ;
106
108
107
109
// Try to acquire the mutex for the plugin state variables, timeout = 25mS
108
- if ( ! (state = ( state_t * ) acquire_mutex (( ValueMutex * ) ctx , 25 )) ) return ;
110
+ if (furi_mutex_acquire (state -> mutex , 25 ) != FuriStatusOk ) return ;
109
111
110
112
switch (state -> scene ) {
111
113
//---------------------------------------------------------------------
@@ -190,7 +192,7 @@ void cbDraw (Canvas* const canvas, void* ctx)
190
192
}
191
193
192
194
// Release the mutex
193
- release_mutex (( ValueMutex * ) ctx , state );
195
+ furi_mutex_release ( state -> mutex );
194
196
195
197
LEAVE ;
196
198
return ;
@@ -320,7 +322,6 @@ int32_t wii_ec_anal (void)
320
322
Gui * gui = NULL ;
321
323
ViewPort * vpp = NULL ;
322
324
state_t * state = NULL ;
323
- ValueMutex mutex = {0 };
324
325
FuriMessageQueue * queue = NULL ;
325
326
const uint32_t queueSz = 20 ; // maximum messages in queue
326
327
uint32_t tmo = (3.5f * 1000 ); // timeout splash screen after N seconds
@@ -358,7 +359,7 @@ int32_t wii_ec_anal (void)
358
359
goto bail ;
359
360
}
360
361
// 5. Create a mutex for (reading/writing) the plugin state variables
361
- if (! init_mutex ( & mutex , state , sizeof ( state )) ) {
362
+ if ( !( state -> mutex = furi_mutex_alloc ( FuriMutexTypeNormal )) ) {
362
363
ERROR (wii_errs [(error = ERR_NO_MUTEX )]);
363
364
goto bail ;
364
365
}
@@ -372,7 +373,7 @@ int32_t wii_ec_anal (void)
372
373
// 7a. Register a callback for input events
373
374
view_port_input_callback_set (vpp , cbInput , queue );
374
375
// 7b. Register a callback for draw events
375
- view_port_draw_callback_set (vpp , cbDraw , & mutex );
376
+ view_port_draw_callback_set (vpp , cbDraw , state );
376
377
377
378
// ===== Start GUI Interface =====
378
379
// 8. Attach the viewport to the GUI
@@ -432,7 +433,7 @@ int32_t wii_ec_anal (void)
432
433
// Read successful
433
434
434
435
// *** Try to lock the plugin state variables ***
435
- if ( ! (state = ( state_t * ) acquire_mutex_block ( & mutex )) ) {
436
+ if (furi_mutex_acquire (state -> mutex , FuriWaitForever ) != FuriStatusOk ) {
436
437
ERROR (wii_errs [(error = ERR_MUTEX_BLOCK )]);
437
438
goto bail ;
438
439
}
@@ -473,7 +474,7 @@ int32_t wii_ec_anal (void)
473
474
if (redraw ) view_port_update (vpp ) ;
474
475
475
476
// *** Try to release the plugin state variables ***
476
- if ( ! release_mutex ( & mutex , state ) ) {
477
+ if (furi_mutex_release ( state -> mutex ) != FuriStatusOk ) {
477
478
ERROR (wii_errs [(error = ERR_MUTEX_RELEASE )]);
478
479
goto bail ;
479
480
}
@@ -511,9 +512,9 @@ int32_t wii_ec_anal (void)
511
512
}
512
513
513
514
// 5. Free the mutex
514
- if (mutex . mutex ) {
515
- delete_mutex ( & mutex );
516
- mutex . mutex = NULL ;
515
+ if (state -> mutex ) {
516
+ furi_mutex_free ( state -> mutex );
517
+ state -> mutex = NULL ;
517
518
}
518
519
519
520
// 4. Free up state pointer(s)
0 commit comments