Close

Realization and code refactoring

A project log for DIAVOX Cellphone

Turning an old diavox phone into a cellphone. No smart stuff, just a telephone. Pick up the handset and dial just like the old days.

anders-helgessonAnders Helgesson 12/27/2024 at 21:270 Comments

Yesterday, I had a bug in my code when reading from the SLG46826V, it turned out to be that there was no grace period between commands to the MCP2221A. At work it suddenly popped up in my mind, maybe the other problems with the MCP2221A could be because of no grace time.

I started adding the grace time everywhere without realizing that I could just add it twice, since most code executes commands using the two same functions... stupid me. I'm going to refactor the code. I simply added the grace time to the send_command and read_response. Now I could remove all the other grace time before all the calls to these functions. Now I need to backup my code, before refactoring further.

I should probably move all MCP2221A related code into it's own library. Sadly no time for that today.

Discussions