Debugging why it doesn't work on the RPi Pico

This commit is contained in:
Rodrigo Alfonso 2024-08-19 03:48:19 -03:00
parent 004a796cc3
commit ec06a49073
3 changed files with 9 additions and 4 deletions

View File

@ -141,7 +141,7 @@ LIBDIRS := $(TONCLIB) $(PWD)/../_lib/libugba
# --- switches ---
bMB := 0 # Multiboot build
bMB := 1 # Multiboot build
bTEMPS := 0 # Save gcc temporaries (.i and .s files)
bDEBUG2 := 0 # Generate debug info (bDEBUG2? Not a full DEBUG flag. Yet)

View File

@ -533,6 +533,7 @@ std::string getErrorString(LinkMobile::Error error) {
toHex(error.cmdId) +
"\n CmdResult: " + getResultString(error.cmdResult) +
"\n CmdErrorCode: " + std::to_string(error.cmdErrorCode) +
"\n TEST: " + toHex(error.notWaiting) +
"\n ReqType: " + std::to_string(error.reqType) + "\n";
}

View File

@ -100,8 +100,8 @@ class LinkMobile {
using u8 = unsigned char;
static constexpr auto BASE_FREQUENCY = Link::_TM_FREQ_1024;
static constexpr int INIT_WAIT_FRAMES = 7;
static constexpr int INIT_TIMEOUT_FRAMES = 30;
static constexpr int INIT_WAIT_FRAMES = 30;
static constexpr int INIT_TIMEOUT_FRAMES = 60;
static constexpr int PING_FREQUENCY_FRAMES = 60;
static constexpr int ADAPTER_WAITING = 0xd2;
static constexpr u32 ADAPTER_WAITING_32BIT = 0xd2d2d2d2;
@ -254,6 +254,7 @@ class LinkMobile {
u8 cmdId = 0;
CommandResult cmdResult = CommandResult::PENDING;
u8 cmdErrorCode = 0;
u32 notWaiting = 0;
bool cmdIsSending = false;
int reqType = -1;
};
@ -830,6 +831,7 @@ class LinkMobile {
u16 expectedChecksum;
u8 errorCommandId;
u8 errorCode;
u32 notWaiting = 0;
bool isActive = false;
void reset() {
@ -1528,9 +1530,9 @@ class LinkMobile {
.cmdId = asyncCommand.relatedCommandId(),
.cmdResult = asyncCommand.result,
.cmdErrorCode = asyncCommand.errorCode,
.notWaiting = asyncCommand.notWaiting,
.cmdIsSending =
asyncCommand.direction == AsyncCommand::Direction::SENDING,
.reqType = userRequests.isEmpty() ? -1 : userRequests.peek().type};
_LMLOG_(
@ -1628,6 +1630,7 @@ class LinkMobile {
asyncCommand.transferred >= mainSize + CHECKSUM_SIZE + 1;
if (!isAcknowledgement && newData != ADAPTER_WAITING) {
_LMLOG_("!! not waiting: %X", newData);
asyncCommand.notWaiting = newData;
return asyncCommand.fail(CommandResult::NOT_WAITING);
}
@ -1664,6 +1667,7 @@ class LinkMobile {
if (!isAcknowledgement && newData != ADAPTER_WAITING &&
newData != ADAPTER_WAITING_32BIT) {
_LMLOG_("!! not waiting: %X", newData);
asyncCommand.notWaiting = newData;
return asyncCommand.fail(CommandResult::NOT_WAITING);
}