Skip to content

Commit 0fce09a

Browse files
fiamDzikuVx
authored andcommitted
[OSD]: Workaround for F3 64 byte write bug on macOS
Upload fonts with address <= 255 using MSPv1, use MSPv2 for fonts with address > 255. This ensures we never send a payload with one of the problematic lengths.
1 parent 68d6d12 commit 0fce09a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tabs/osd.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,11 @@ FONT.upload = function (callback) {
290290
if (callback) {
291291
callback(idx, count, (idx / count) * 100);
292292
}
293-
// Force usage of V1 protocol to workaround the 64 byte write bug
293+
// Force usage of V1/V2 protocol to workaround the 64 byte write bug
294294
// on F3 when the configurator is running on macOS
295-
return MSP.promise(MSPCodes.MSP_OSD_CHAR_WRITE, FONT.msp.encode(next, MSP.constants.PROTOCOL_V1));
295+
var proto = next <= 255 ? MSP.constants.PROTOCOL_V1 : MSP.constants.PROTOCOL_V2;
296+
var data = FONT.msp.encode(next);
297+
return MSP.promise(MSPCodes.MSP_OSD_CHAR_WRITE, data, proto);
296298
});
297299
}, Promise.resolve()).then(function() {
298300
OSD.GUI.jbox.close();

0 commit comments

Comments
 (0)