| | |
| | | commands_.push_back({CONFIG_CUSTOM_WAKE_WORD, CONFIG_CUSTOM_WAKE_WORD_DISPLAY, "wake"}); |
| | | #endif |
| | | commands_.push_back({OFFLINE_COMMAND_WORD_PINYIN, OFFLINE_COMMAND_WORD, "offline_command"}); |
| | | commands_.push_back({OFFLINE_COMMAND_WORD_ALT_PINYIN, OFFLINE_COMMAND_WORD_ALT, "offline_command"}); |
| | | commands_.push_back({OFFLINE_REPEATER_WORD_PINYIN, OFFLINE_REPEATER_WORD, "offline_command"}); |
| | | commands_.push_back({OFFLINE_START_REPEATER_WORD_PINYIN, OFFLINE_START_REPEATER_WORD, "offline_command"}); |
| | | commands_.push_back({OFFLINE_EXIT_REPEATER_WORD_PINYIN, OFFLINE_EXIT_REPEATER_WORD, "offline_command"}); |
| | | commands_.push_back({OFFLINE_EXIT_SHADOWING_WORD_PINYIN, OFFLINE_EXIT_SHADOWING_WORD, "offline_command"}); |
| | | commands_.push_back({OFFLINE_CHAT_WORD_PINYIN, OFFLINE_CHAT_WORD, "offline_command"}); |
| | | commands_.push_back({OFFLINE_CHAT_WORD_FULL_PINYIN, OFFLINE_CHAT_WORD_FULL, "offline_command"}); |
| | | } else { |
| | | models_ = models_list; |
| | | ParseWakenetModelConfig(); |
| | |
| | | commands_.push_back({BOARD_CUSTOM_WAKE_WORD_PINYIN, BOARD_CUSTOM_WAKE_WORD_DISPLAY, "wake"}); |
| | | #endif |
| | | commands_.push_back({OFFLINE_COMMAND_WORD_PINYIN, OFFLINE_COMMAND_WORD, "offline_command"}); |
| | | commands_.push_back({OFFLINE_COMMAND_WORD_ALT_PINYIN, OFFLINE_COMMAND_WORD_ALT, "offline_command"}); |
| | | commands_.push_back({OFFLINE_REPEATER_WORD_PINYIN, OFFLINE_REPEATER_WORD, "offline_command"}); |
| | | commands_.push_back({OFFLINE_START_REPEATER_WORD_PINYIN, OFFLINE_START_REPEATER_WORD, "offline_command"}); |
| | | commands_.push_back({OFFLINE_EXIT_REPEATER_WORD_PINYIN, OFFLINE_EXIT_REPEATER_WORD, "offline_command"}); |
| | | commands_.push_back({OFFLINE_EXIT_SHADOWING_WORD_PINYIN, OFFLINE_EXIT_SHADOWING_WORD, "offline_command"}); |
| | | commands_.push_back({OFFLINE_CHAT_WORD_PINYIN, OFFLINE_CHAT_WORD, "offline_command"}); |
| | | commands_.push_back({OFFLINE_CHAT_WORD_FULL_PINYIN, OFFLINE_CHAT_WORD_FULL, "offline_command"}); |
| | | } |
| | | |
| | | if (models_ == nullptr || models_->num == -1) { |
| | |
| | | if (mn_state == ESP_MN_STATE_DETECTED) { |
| | | esp_mn_results_t *mn_result = multinet_->get_results(multinet_model_data_); |
| | | for (int i = 0; i < mn_result->num && running_; i++) { |
| | | ESP_LOGI(TAG, "Custom wake word detected: command_id=%d, string=%s, prob=%f", |
| | | mn_result->command_id[i], mn_result->string, mn_result->prob[i]); |
| | | auto& command = commands_[mn_result->command_id[i] - 1]; |
| | | int command_id = mn_result->command_id[i]; |
| | | ESP_LOGI(TAG, "Custom wake word detected: command_id=%d, string=%s, prob=%f", |
| | | command_id, mn_result->string, mn_result->prob[i]); |
| | | if (command_id < 1 || command_id > static_cast<int>(commands_.size())) { |
| | | continue; |
| | | } |
| | | auto& command = commands_[command_id - 1]; |
| | | if (command.action == "wake") { |
| | | last_detected_wake_word_ = command.text; |
| | | running_ = false; |