增加单击SW2抽签功能
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "domain_internal.h"
|
||||
#include "platform.h"
|
||||
#include "esp_random.h"
|
||||
#include "esp_log.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/portmacro.h"
|
||||
@@ -77,6 +78,13 @@ static const uint8_t s_server_error_frame_order[] = {0, 1, 2, 1, 0};
|
||||
static const uint8_t s_wifi_disconnected_frame_order[] = {0, 1, 2, 3, 2, 1, 0};
|
||||
static const uint8_t s_basic_face_frame_order[] = {0, 1, 2};
|
||||
static const uint8_t s_muyu_frame_order[] = {0, 1, 2, 1};
|
||||
static const char *const s_chouqian_result_asset_dirs[] = {
|
||||
"chouqian_buyun",
|
||||
"chouqian_heping",
|
||||
"chouqian_shangshang",
|
||||
"chouqian_xiaoji",
|
||||
"chouqian_zhongshang",
|
||||
};
|
||||
|
||||
/*
|
||||
* Wealth-direction reveal asset directories, indexed parallel to the direction
|
||||
@@ -95,6 +103,7 @@ static const char *const s_wealth_direction_asset_dirs[] = {
|
||||
};
|
||||
|
||||
#define DOMAIN_WEALTH_DIRECTION_FRAME_MS 100U
|
||||
#define DOMAIN_CHOUQIAN_FRAME_MS 500U
|
||||
|
||||
#define DOMAIN_AUTH_KEY_STORE_NAMESPACE "auth_key"
|
||||
#define DOMAIN_AUTH_STATE_STORE_NAMESPACE "auth"
|
||||
@@ -1244,6 +1253,55 @@ static esp_err_t domain_resolve_expression_platform_request(
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
if (request->id == DOMAIN_EXPRESSION_CHOUQIAN) {
|
||||
static platform_lcd_presentation_step_t s_chouqian_steps[6];
|
||||
const size_t result_count = sizeof(s_chouqian_result_asset_dirs) /
|
||||
sizeof(s_chouqian_result_asset_dirs[0]);
|
||||
const char *result_asset = s_chouqian_result_asset_dirs[esp_random() % result_count];
|
||||
|
||||
s_chouqian_steps[0] = (platform_lcd_presentation_step_t) {
|
||||
.asset_dir = "chouqian_qianzhi",
|
||||
.frame_index = 0,
|
||||
.delay_ms = DOMAIN_CHOUQIAN_FRAME_MS,
|
||||
};
|
||||
s_chouqian_steps[1] = (platform_lcd_presentation_step_t) {
|
||||
.asset_dir = "chouqian_qianzhi",
|
||||
.frame_index = 1,
|
||||
.delay_ms = DOMAIN_CHOUQIAN_FRAME_MS,
|
||||
};
|
||||
s_chouqian_steps[2] = (platform_lcd_presentation_step_t) {
|
||||
.asset_dir = "chouqian_qianzhi",
|
||||
.frame_index = 2,
|
||||
.delay_ms = DOMAIN_CHOUQIAN_FRAME_MS,
|
||||
};
|
||||
s_chouqian_steps[3] = (platform_lcd_presentation_step_t) {
|
||||
.asset_dir = result_asset,
|
||||
.frame_index = 0,
|
||||
.delay_ms = DOMAIN_CHOUQIAN_FRAME_MS,
|
||||
};
|
||||
s_chouqian_steps[4] = (platform_lcd_presentation_step_t) {
|
||||
.asset_dir = result_asset,
|
||||
.frame_index = 1,
|
||||
.delay_ms = DOMAIN_CHOUQIAN_FRAME_MS,
|
||||
};
|
||||
s_chouqian_steps[5] = (platform_lcd_presentation_step_t) {
|
||||
.asset_dir = result_asset,
|
||||
.frame_index = 2,
|
||||
.delay_ms = DOMAIN_CHOUQIAN_FRAME_MS,
|
||||
};
|
||||
|
||||
*out_platform_request = (platform_lcd_presentation_request_t) {
|
||||
.kind = PLATFORM_LCD_PRESENTATION_STEP_SEQUENCE,
|
||||
.priority = 125,
|
||||
.interrupt_current = true,
|
||||
.return_to_idle = true,
|
||||
.steps = s_chouqian_steps,
|
||||
.step_count = sizeof(s_chouqian_steps) / sizeof(s_chouqian_steps[0]),
|
||||
};
|
||||
ESP_LOGI(TAG, "Chouqian result asset=%s", result_asset);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
const domain_expression_catalog_entry_t *entry = domain_find_expression_entry(request->id);
|
||||
if (entry == NULL) {
|
||||
ESP_LOGW(TAG, "Unknown expression request id=%d trigger=%d",
|
||||
|
||||
Reference in New Issue
Block a user