diff --git a/fw/Core/Hitcon/App/ShowNameApp.cc b/fw/Core/Hitcon/App/ShowNameApp.cc index 06d4a18..5bb61f1 100644 --- a/fw/Core/Hitcon/App/ShowNameApp.cc +++ b/fw/Core/Hitcon/App/ShowNameApp.cc @@ -168,6 +168,15 @@ void ShowNameApp::SetMode(const enum ShowNameMode mode) { update_display(); } +void ShowNameApp::SetSurpriseMsg(const char *msg) { + int len = strlen(msg); + if (len >= kDisplayScrollMaxTextLen) { + len = kDisplayScrollMaxTextLen; + } + memcpy(surprise_msg, msg, len); + surprise_msg[len] = 0; +} + enum ShowNameMode ShowNameApp::GetMode() { return mode; } } // namespace hitcon diff --git a/fw/Core/Hitcon/App/ShowNameApp.h b/fw/Core/Hitcon/App/ShowNameApp.h index e237782..1cde04f 100644 --- a/fw/Core/Hitcon/App/ShowNameApp.h +++ b/fw/Core/Hitcon/App/ShowNameApp.h @@ -36,6 +36,8 @@ class ShowNameApp : public App { void SetMode(const enum ShowNameMode mode); enum ShowNameMode GetMode(); + void SetSurpriseMsg(const char *msg); + void check_update(); private: @@ -44,6 +46,7 @@ class ShowNameApp : public App { hitcon::service::sched::PeriodicTask _routine_task; uint32_t score_cache = 0; + char surprise_msg[kDisplayScrollMaxTextLen + 1]; bool starting_up; unsigned last_disp_update; }; diff --git a/fw/Core/Hitcon/Logic/IrController.cc b/fw/Core/Hitcon/Logic/IrController.cc index b44f779..2bb0bbc 100644 --- a/fw/Core/Hitcon/Logic/IrController.cc +++ b/fw/Core/Hitcon/Logic/IrController.cc @@ -45,6 +45,8 @@ void IrController::Send2Game(void* arg) { send_lock = true; } void IrController::ShowText(void* arg) { + struct ShowPacket* pkt = reinterpret_cast(arg); + show_name_app.SetSurpriseMsg(pkt->message); show_name_app.SetMode(Surprise); badge_controller.change_app(&show_name_app); }