From 8a951acb82e8d17b2732db426361ad10dd2ebe07 Mon Sep 17 00:00:00 2001 From: cTn Date: Tue, 16 Sep 2014 19:24:10 +0200 Subject: [PATCH] new generic crunching mechanism that will be used with all of the future set messages --- js/msp.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/js/msp.js b/js/msp.js index 0af8408c52..939c39b32b 100644 --- a/js/msp.js +++ b/js/msp.js @@ -570,4 +570,30 @@ MSP.send_message = function(code, data, callback_sent, callback_msp) { }); return true; -} \ No newline at end of file +}; + +MSP.crunch = function (name) { + var buffer = []; + + switch (name) { + case 'BF_CONFIG': + buffer.push(BF_CONFIG.mixerConfiguration); + buffer.push(specificByte(BF_CONFIG.features, 0)); + buffer.push(specificByte(BF_CONFIG.features, 1)); + buffer.push(specificByte(BF_CONFIG.features, 2)); + buffer.push(specificByte(BF_CONFIG.features, 3)); + buffer.push(BF_CONFIG.serialrx_type); + buffer.push(specificByte(BF_CONFIG.board_align_roll, 0)); + buffer.push(specificByte(BF_CONFIG.board_align_roll, 1)); + buffer.push(specificByte(BF_CONFIG.board_align_pitch, 0)); + buffer.push(specificByte(BF_CONFIG.board_align_pitch, 1)); + buffer.push(specificByte(BF_CONFIG.board_align_yaw, 0)); + buffer.push(specificByte(BF_CONFIG.board_align_yaw, 1)); + break; + + default: + return false; + } + + return buffer; +}; \ No newline at end of file