-
Notifications
You must be signed in to change notification settings - Fork 10
User data is not saved #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That sounds like a good improvement, but I'm not sure where reset_type comes from. Any chance you could do a pull request so we can incorporate your changes? |
its simply a global, that is set in the main program (uint32_t reset_type)
then its copied to the EEPROM with the address.
You already had a data field, but it was always oddly zero (m_CrashReport.m_uData = 0)
So now we make it a real value (reset_type) set in the main program, and assign it to uData: (m_CrashReport.m_uData = reset_type)
Then we have to write that value out to the EEPROM:
memcpy(m_CrashReport.m_auAddress+PROGRAM_COUNTER_SIZE, &reset_type, PROGRAM_COUNTER_SIZE);
so its your original program, fixed for real data versus zero!
Rob
From: Paul Martinsen ***@***.***>
Sent: Thursday, February 2, 2023 2:45 AM
To: Megunolink/ArduinoCrashMonitor ***@***.***>
Cc: riwalker ***@***.***>; Author ***@***.***>
Subject: Re: [Megunolink/ArduinoCrashMonitor] User data is not saved (Issue #6)
That sounds like a good improvement, but I'm not sure where reset_type comes from. Any chance you could do a pull request so we can incorporate your changes?
—
Reply to this email directly, view it on GitHub <#6 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABIKT5RZQ4E7F53LTRQUQULWVNQXPANCNFSM6AAAAAAUOJIVKU> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/ABIKT5VML4BQ6BEZR3VDLJTWVNQXPA5CNFSM6AAAAAAUOJIVKWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSUHT6TQ.gif> Message ID: ***@***.*** ***@***.***> >
|
Any advice why integrating other code using USART Interrupts, that the combo of this code causes a death of the micro - I guess its stuck in bootloader |
I had to make 2 changes:
CApplicationMonitor::CApplicationMonitor(int nBaseAddress, int nMaxEntries)
: c_nBaseAddress(nBaseAddress), c_nMaxEntries(nMaxEntries)
{
m_CrashReport.m_uData = reset_type;
}
Write the userdata with memcpy
void CApplicationMonitor::WatchdogInterruptHandler(uint8_t *puProgramAddress)
{
CApplicationMonitorHeader Header;
LoadHeader(Header);
memcpy(m_CrashReport.m_auAddress, puProgramAddress, PROGRAM_COUNTER_SIZE);
//RIW fix to write the user data
memcpy(m_CrashReport.m_auAddress+PROGRAM_COUNTER_SIZE, &reset_type, PROGRAM_COUNTER_SIZE);
SaveCurrentReport(Header.m_uNextReport);
The text was updated successfully, but these errors were encountered: