Skip to content

Commit

Permalink
電源ボタン長押しによる初期化を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
shuichitakano committed Nov 25, 2024
1 parent f6588f7 commit f4c30e9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
6 changes: 5 additions & 1 deletion board.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ inline constexpr uint32_t CPU_CLOCK = 125000000;
#if EA_V2

#define BOARD_NAME "EA2"
#define BOARD_VERSION "V1.0.1"
#define BOARD_VERSION "V1.0.2"

// * v1.0.2
// - All Reset メニューでロータリーエンコーダの初期化反映が漏れていたのを修正
// - 電源OFF 時に電源ボタンを 20s 押し続けると All Reset する機能を追加

inline constexpr bool HAS_LCD = true;

Expand Down
2 changes: 2 additions & 0 deletions docs/easy_arcade.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ C-SYNC は 3, 7, 9 ピンに出力されていますのでケーブルを選ぶ
### POWER/CONFIG ボタン
電源のOn/Off および、メニューの開閉に使用します。

ℹ️ 電源OFF時に電源ボタンを20秒押し続けると出荷時状態に初期化します。(v1.0.2-)

### TEST, SERVICE ボタン
JAMMA側の TEST, SERVICE に接続されています。

Expand Down
29 changes: 21 additions & 8 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,13 +442,20 @@ void resetRapidSettings()
}
}

void applySettings()
{
setRapidPhaseMask();
setRapidSettings();
setRotEncSettings(0);
setRotEncSettings(1);
}

void resetConfigs()
{
appConfig_ = AppConfig();
PadManager::instance().resetConfig();

setRapidPhaseMask();
setRapidSettings();
applySettings();
}

void load()
Expand All @@ -468,10 +475,7 @@ void load()
PadManager::instance().deserialize(s);

//
setRapidPhaseMask();
setRapidSettings();
setRotEncSettings(0);
setRotEncSettings(1);
applySettings();

DPRINT(("Loaded.\n"));
}
Expand Down Expand Up @@ -1033,8 +1037,9 @@ int main()
{
ctCnfPush = ct32;
}
constexpr uint32_t CT_MIDDLEPUSH = CPU_CLOCK * 1; // 1s
constexpr uint32_t CT_LONGPUSH = CPU_CLOCK * 3; // 3s
constexpr uint32_t CT_MIDDLEPUSH = CPU_CLOCK * 1 /*s*/;
constexpr uint32_t CT_LONGPUSH = CPU_CLOCK * 3 /*s*/;
constexpr uint32_t CT_ALLINIT = CPU_CLOCK * 20 /*s*/;

bool btCnfMiddle = btCnf && (ct32 - ctCnfPush > CT_MIDDLEPUSH);
bool btCnfMiddleTrigger = !prevBtCnfMiddle && btCnfMiddle;
Expand All @@ -1048,6 +1053,14 @@ int main()
{
power = powerOn();
}
else if (btCnf && (ct32 - ctCnfPush) > CT_ALLINIT)
{
DPRINT(("init all\n"));
textScreen_.printInfo(0, 0, "ALL");
textScreen_.printInfo(0, 1, " Init'd");
textScreen_.setInfoLayerClearTimer(CPU_CLOCK);
resetConfigs();
}
// sleep_ms(100); // 省電力?
}
else
Expand Down

0 comments on commit f4c30e9

Please sign in to comment.