Update RPS for latest API changes

This commit is contained in:
Derek Jamison 2023-07-11 09:45:07 -05:00
parent 8a782817c7
commit a9915dc092
2 changed files with 6 additions and 1 deletions

View File

@ -1339,7 +1339,9 @@ static bool update_frequency(GameContext* game_context) {
// Try to start the TX/RX on the frequency and configure our callback // Try to start the TX/RX on the frequency and configure our callback
// whenever new data is received. // whenever new data is received.
if(subghz_tx_rx_worker_start(game_context->subghz_txrx, frequency)) { const SubGhzDevice* device = subghz_devices_get_by_name(SUBGHZ_DEVICE_CC1101_INT_NAME);
furi_assert(device);
if(subghz_tx_rx_worker_start(game_context->subghz_txrx, device, frequency)) {
subghz_tx_rx_worker_set_callback_have_read( subghz_tx_rx_worker_set_callback_have_read(
game_context->subghz_txrx, rps_worker_update_rx_event_callback, game_context); game_context->subghz_txrx, rps_worker_update_rx_event_callback, game_context);
} else { } else {
@ -1879,6 +1881,7 @@ int32_t rock_paper_scissors_app(void* p) {
// Subghz worker. // Subghz worker.
game_context->subghz_txrx = subghz_tx_rx_worker_alloc(); game_context->subghz_txrx = subghz_tx_rx_worker_alloc();
subghz_devices_init();
// All the subghz CLI apps disable charging; so our game does it too. // All the subghz CLI apps disable charging; so our game does it too.
furi_hal_power_suppress_charge_enter(); furi_hal_power_suppress_charge_enter();
@ -2520,6 +2523,7 @@ int32_t rock_paper_scissors_app(void* p) {
subghz_tx_rx_worker_stop(game_context->subghz_txrx); subghz_tx_rx_worker_stop(game_context->subghz_txrx);
} }
subghz_tx_rx_worker_free(game_context->subghz_txrx); subghz_tx_rx_worker_free(game_context->subghz_txrx);
subghz_devices_deinit();
view_port_enabled_set(view_port, false); view_port_enabled_set(view_port, false);
gui_remove_view_port(gui, view_port); gui_remove_view_port(gui, view_port);
view_port_free(view_port); view_port_free(view_port);

View File

@ -13,6 +13,7 @@
#include <storage/storage.h> #include <storage/storage.h>
#include <lib/subghz/subghz_tx_rx_worker.h> #include <lib/subghz/subghz_tx_rx_worker.h>
#include <lib/subghz/devices/cc1101_int/cc1101_int_interconnect.h>
#define RPS_APPS_DATA_FOLDER EXT_PATH("apps_data") #define RPS_APPS_DATA_FOLDER EXT_PATH("apps_data")
#define RPS_GAME_FOLDER \ #define RPS_GAME_FOLDER \