It's a corexy so your homing file needs a slight modification to work correctly. Right now you're moving both X and Y at the same time to the endstop, and when the first one strikes, it stops both. Then you ask it to back off both, but one of them won't have been homed yet.
Try this
; homeall.g
; called to home all axes
;
; generated by RepRapFirmware Configuration Tool v3.3.15 on Fri Mar 17 2023 09:18:48 GMT+0100 (Ora standard dell’Europa centrale)
G91 ; relative positioning
;G1 H2 Z5 F6000 ; lift Z relative to current position
G1 H1 X-395 Y-345 F3000 ; move quickly to X or Y endstop and stop there (first pass)
G1 H1 X-395 ; make sure both are homed
G1 H1 Y-345
G1 X5 Y5 F1800 ; go back a few mm
G1 H1 X-10 F360 ; home again
G1 H1 Y-10
G1 H1 Z410 F1800 ; move Z up until the endstop is triggered
G92 Z410 ; set Z position to axis maximum (you may want to adjust this)
G90 ; absolute position