I finally finished the damned thing which fought me all the way...
The problem with the osd is poor quality of the osd chip and the matek
board is prone to interference from the video tx and the various power
supplies that exist on board.
I changed it with a new MAX7456 and it worked fine, i am afraid that
either i got a lemon or the matek board is not of high quality, there
was no problem with the code but with the hardware so everything there
is in the github link i gave is working fine.
Btw the AT7456's character generator is a joke, even English look like
Chinese and The matek f405 wing version has the osd connected in
different pins that those in Betaflght and Inav, i had to manually trace