Skip to content
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

Pincode saved incorrectly in memory #641

Closed
pvtex opened this issue Jun 6, 2024 · 7 comments
Closed

Pincode saved incorrectly in memory #641

pvtex opened this issue Jun 6, 2024 · 7 comments
Milestone

Comments

@pvtex
Copy link

pvtex commented Jun 6, 2024

the pincode of a user is not read succesfully.
sometimes a pincode form an other user is shown.
looking in the user files in the SPIFFS filesystem the pincodes are right.

image

in the filesystem:

{"command":"userfile","uid":"???????","pincode":"8721","user":"Bjoern","acctype":99,"acctype2":null,"acctype3":null,"acctype4":null,"validsince":0,"validuntil":2145916800}
@pvtex
Copy link
Author

pvtex commented Jun 7, 2024

the pin that you enter in the user mask is active and can be used.
but if you reload the user list all users are showing the same pincode of one random user.

@pvtex
Copy link
Author

pvtex commented Jun 7, 2024

with debugoutputs i can see that the right pins are read in void ICACHE_FLASH_ATTR sendUserList

but on the way through serializeJson and ws to the browser it get lost

@pvtex
Copy link
Author

pvtex commented Jun 7, 2024

the json opject item hold the right pincode.
the jsonarray users has wrong pincodes.

@pvtex
Copy link
Author

pvtex commented Jun 7, 2024

think i found the solution the variable pincode was declared as const char.
const chars are used as pointers in nestedobject.
cast pincode to a string should help

@pvtex
Copy link
Author

pvtex commented Jun 7, 2024

had to change the file wsResponses.esp

line 28-32

String pincode = "";
if(json.containsKey("pincode"))
{
	pincode = String((const char*)json["pincode"]);
}

@matjack1 matjack1 changed the title v2 problems with users Pincode saved incorrectly in memory Jun 11, 2024
@matjack1
Copy link
Collaborator

Thank you very much @pvtex for reporting this bug. I can confirm it.

The problem I think it's earlier than the lines highlighted in your last comment, unfortunately. I was able to reproduce the pincode corruption even by just updating manually a few of the pincodes. I'm going to fix this surely before v2 is done.

Sorry for this and thank you very much for reporting.

@matjack1 matjack1 added this to the V2 milestone Jun 11, 2024
@matjack1
Copy link
Collaborator

You were right @pvtex !

I've applied your fix and that's fine :) I'm going to close this as the fix is in dev.

Thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants