@@ -86,6 +86,8 @@ void showVer (Canvas* const canvas)
8686 show (canvas , 4 ,59 , VER_MAJ , SHOW_SET_BLK );
8787 canvas_draw_frame (canvas , 8 ,62 , 2 ,2 );
8888 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 );
8991}
9092
9193//+============================================================================
@@ -102,10 +104,10 @@ void cbDraw (Canvas* const canvas, void* ctx)
102104 furi_assert (canvas );
103105 furi_assert (ctx );
104106
105- state_t * state = NULL ;
107+ state_t * state = ctx ;
106108
107109 // 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 ;
109111
110112 switch (state -> scene ) {
111113 //---------------------------------------------------------------------
@@ -190,7 +192,7 @@ void cbDraw (Canvas* const canvas, void* ctx)
190192 }
191193
192194 // Release the mutex
193- release_mutex (( ValueMutex * ) ctx , state );
195+ furi_mutex_release ( state -> mutex );
194196
195197 LEAVE ;
196198 return ;
@@ -320,7 +322,6 @@ int32_t wii_ec_anal (void)
320322 Gui * gui = NULL ;
321323 ViewPort * vpp = NULL ;
322324 state_t * state = NULL ;
323- ValueMutex mutex = {0 };
324325 FuriMessageQueue * queue = NULL ;
325326 const uint32_t queueSz = 20 ; // maximum messages in queue
326327 uint32_t tmo = (3.5f * 1000 ); // timeout splash screen after N seconds
@@ -358,7 +359,7 @@ int32_t wii_ec_anal (void)
358359 goto bail ;
359360 }
360361 // 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 )) ) {
362363 ERROR (wii_errs [(error = ERR_NO_MUTEX )]);
363364 goto bail ;
364365 }
@@ -372,7 +373,7 @@ int32_t wii_ec_anal (void)
372373 // 7a. Register a callback for input events
373374 view_port_input_callback_set (vpp , cbInput , queue );
374375 // 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 );
376377
377378 // ===== Start GUI Interface =====
378379 // 8. Attach the viewport to the GUI
@@ -432,7 +433,7 @@ int32_t wii_ec_anal (void)
432433 // Read successful
433434
434435 // *** 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 ) {
436437 ERROR (wii_errs [(error = ERR_MUTEX_BLOCK )]);
437438 goto bail ;
438439 }
@@ -473,7 +474,7 @@ int32_t wii_ec_anal (void)
473474 if (redraw ) view_port_update (vpp ) ;
474475
475476 // *** Try to release the plugin state variables ***
476- if ( ! release_mutex ( & mutex , state ) ) {
477+ if (furi_mutex_release ( state -> mutex ) != FuriStatusOk ) {
477478 ERROR (wii_errs [(error = ERR_MUTEX_RELEASE )]);
478479 goto bail ;
479480 }
@@ -511,9 +512,9 @@ int32_t wii_ec_anal (void)
511512 }
512513
513514 // 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 ;
517518 }
518519
519520 // 4. Free up state pointer(s)
0 commit comments