Skip to content

Commit

Permalink
Fix bug which caused ir to not properly initalize after sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
hax0kartik committed Dec 31, 2023
1 parent 5246fa7 commit da0ac40
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions source/hid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ void Hid::EnteringSleepMode()
{
LightLock_Lock(&m_sleeplock); // now that main thread accquired the lock, sampling thread will get stuck
svcClearEvent(dummyhandles[2]);
iruExit_();

PTMSYSM_NotifySleepPreparationComplete(0);
}

Expand All @@ -201,6 +203,8 @@ void Hid::ExitingSleepMode()
m_debugpadring->Reset();
m_pad.SetTimer();
m_debugpad.SetTimer();
irInit();

PTMSYSM_NotifySleepPreparationComplete(0);
}

Expand Down
1 change: 1 addition & 0 deletions source/irrst.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "exclusive_rw.hpp"

Result iruInit_(uint8_t steal = 0);
void iruExit_(void);
void irrstExit_(void);
void iruScanInput_(void);
u32 iruKeysHeld_(void);
Expand Down
4 changes: 2 additions & 2 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ static Result HandleNotifications(Hid *hid, int *exit)

case 0x104: // Entering SleepMode
{
irneeded = 0;
irneeded <<= 1;
hid->EnteringSleepMode();
break;
}

case 0x105: // Exiting SleepMode
{
irneeded = 1;
irneeded >>= 1;
hid->ExitingSleepMode();
break;
}
Expand Down

0 comments on commit da0ac40

Please sign in to comment.