Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reworked rc channel remapping #1560

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@
"fcInfoReceived": {
"message": "Flight controller info, identifier: <strong>$1</strong>, version: <strong>$2</strong>"
},

"targetInfoReceived": {
"message": "Target variant: <strong>$1</strong>, is variable pitch: <strong>$2</strong>"
},

"notifications_app_just_updated_to_version": {
"message": "Application just updated to version: $1"
},
Expand Down Expand Up @@ -2255,6 +2258,12 @@
},
"controlAxisThrottle": {
"message": "Throttle [T]"
},
"controlAxisCollective": {
"message": "Collective [C]"
},
"controlGyroGain": {
"message": "Gyro gain [G]"
},
"radioChannelShort": {
"message": "CH "
Expand Down
Empty file modified eventPage.js
100755 → 100644
Empty file.
13 changes: 10 additions & 3 deletions js/fc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
'use strict';

// define all the global variables that are uses to hold FC state
const TARGET = { // sibi?
fullIdentifier: "",
isVariablePitch: false,
}

var CONFIG,
LED_STRIP,
LED_COLORS,
Expand Down Expand Up @@ -801,7 +806,7 @@ var FC = {
}
},
getRcMapLetters: function () {
return ['A', 'E', 'R', 'T'];
return TARGET.isVariablePitch ? ['A', 'E', 'R', 'T', '1', '2', 'C', 'G'] : ['A', 'E', 'R', 'T', '1', '2', '3', '4']; // sibi?
},
isRcMapValid: function (val) {
var strBuffer = val.split(''),
Expand All @@ -812,6 +817,8 @@ var FC = {

// check if characters inside are all valid, also check for duplicity
for (var i = 0; i < val.length; i++) {
//strBuffer[i] = (strBuffer[i] == 'C') ? '3' : strBuffer[i]; // sibi?
//strBuffer[i] = (strBuffer[i] == 'G') ? '4' : strBuffer[i];
if (FC.getRcMapLetters().indexOf(strBuffer[i]) < 0)
return false;

Expand All @@ -835,8 +842,8 @@ var FC = {
'RC Throttle', // 7
'RC Channel 5', // 8
'RC Channel 6', // 9
'RC Channel 7', // 10
'RC Channel 8', // 11
TARGET.isVariablePitch ? 'RC Collective Pitch' : 'RC Channel 7', // 10
TARGET.isVariablePitch ? 'RC Gyro Gain' : 'RC Channel 8', // 11
'Gimbal Pitch', // 12
'Gimbal Roll', // 13
'Flaperon Mode', // 14
Expand Down
72 changes: 70 additions & 2 deletions js/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const INPUT_STABILIZED_ROLL = 0,
INPUT_GIMBAL_PITCH = 12,
INPUT_GIMBAL_ROLL = 13,
INPUT_FEATURE_FLAPS = 14;

const INPUT_RC_COLLECTIVE = INPUT_RC_AUX3;

const
PLATFORM_MULTIROTOR = 0,
Expand Down Expand Up @@ -589,7 +591,73 @@ const mixerList = [
motorMixer: [],
servoMixer: []
}, // 16

{
id: 35,
name: 'HeliQuad',
model: 'quad_x',
image: 'heli_quad_x',
enabled: true,
legacy: true,
platform: PLATFORM_HELICOPTER,
motorMixer: [
new MotorMixRule(1.0, 0, 0, 0), // MOTOR OUT 1
new MotorMixRule(1.0, 0, 0, 0), // MOTOR OUT 2
],
servoMixer: [
new ServoMixRule(0, INPUT_STABILIZED_ROLL, -100, 0), //REAR_R
new ServoMixRule(0, INPUT_STABILIZED_PITCH, 100, 0),
new ServoMixRule(0, INPUT_STABILIZED_YAW, -100, 0),
new ServoMixRule(0, INPUT_RC_COLLECTIVE, 100, 0),
new ServoMixRule(1, INPUT_STABILIZED_ROLL, -100, 0), //FRONT_R
new ServoMixRule(1, INPUT_STABILIZED_PITCH, -100, 0),
new ServoMixRule(1, INPUT_STABILIZED_YAW, 100, 0),
new ServoMixRule(1, INPUT_RC_COLLECTIVE, 100, 0),
new ServoMixRule(2, INPUT_STABILIZED_ROLL, 100, 0), //REAR_L
new ServoMixRule(2, INPUT_STABILIZED_PITCH, 100, 0),
new ServoMixRule(2, INPUT_STABILIZED_YAW, 100, 0),
new ServoMixRule(2, INPUT_RC_COLLECTIVE, 100, 0),
new ServoMixRule(3, INPUT_STABILIZED_ROLL, 100, 0), //FRONT_L
new ServoMixRule(3, INPUT_STABILIZED_PITCH, -100, 0),
new ServoMixRule(3, INPUT_STABILIZED_YAW, -100, 0),
new ServoMixRule(3, INPUT_RC_COLLECTIVE, 100, 0),
]
}, // 35
{
id: 36,
name: 'Chinook style Bicopter 120deg',
model: 'custom',
image: 'heli_bicopter',
enabled: true,
legacy: true,
platform: PLATFORM_HELICOPTER,
motorMixer: [
new MotorMixRule(1.0, 0, 0, 0), // MOTOR OUT 1
new MotorMixRule(1.0, 0, 0, 0), // MOTOR OUT 2
],
servoMixer: [
new ServoMixRule(0, INPUT_STABILIZED_ROLL, 100, 0), //REAR_L
new ServoMixRule(0, INPUT_STABILIZED_PITCH, 100, 0),
new ServoMixRule(0, INPUT_STABILIZED_YAW, -100, 0),
new ServoMixRule(0, INPUT_RC_COLLECTIVE, 100, 0),
new ServoMixRule(1, INPUT_STABILIZED_ROLL, -100, 0), //REAR_R
new ServoMixRule(1, INPUT_STABILIZED_PITCH, 100, 0),
new ServoMixRule(1, INPUT_STABILIZED_YAW, 100, 0),
new ServoMixRule(1, INPUT_RC_COLLECTIVE, 100, 0),
new ServoMixRule(2, INPUT_STABILIZED_PITCH, 100, 0), //REAR_PITCH
new ServoMixRule(2, INPUT_RC_COLLECTIVE, 100, 0),
new ServoMixRule(3, INPUT_STABILIZED_ROLL, 100, 0), //FRONT_L
new ServoMixRule(3, INPUT_STABILIZED_PITCH, -100, 0),
new ServoMixRule(3, INPUT_STABILIZED_YAW, 100, 0),
new ServoMixRule(3, INPUT_RC_COLLECTIVE, 100, 0),
new ServoMixRule(4, INPUT_STABILIZED_ROLL, -100, 0), //FRONT_R
new ServoMixRule(4, INPUT_STABILIZED_PITCH, -100, 0),
new ServoMixRule(4, INPUT_STABILIZED_YAW, -100, 0),
new ServoMixRule(4, INPUT_RC_COLLECTIVE, 100, 0),
new ServoMixRule(5, INPUT_STABILIZED_PITCH, -100, 0), //FRONT_PITCH
new ServoMixRule(5, INPUT_RC_COLLECTIVE, 100, 0),
]
}, // 36

// ** Other platforms **
{
id: 31,
Expand Down Expand Up @@ -677,7 +745,7 @@ const platformList = [
{
id: 2,
name: "Helicopter",
enabled: false,
enabled: true,
flapsPossible: false
},
{
Expand Down
7 changes: 7 additions & 0 deletions js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,13 @@ var mspHelper = (function (gui) {
CONFIG.boardIdentifier = identifier;
CONFIG.boardVersion = data.getUint16(offset, 1);
offset += 2;
//sibi?
offset += 3;
TARGET.fullIdentifier = "";
for (let i = offset; i < data.byteLength; i++) {
TARGET.fullIdentifier += String.fromCharCode(data.getUint8(i));
}
TARGET.isVariablePitch = TARGET.fullIdentifier.includes('_VP');
break;

case MSPCodes.MSP_SET_CHANNEL_FORWARDING:
Expand Down
1 change: 1 addition & 0 deletions js/serial_backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ function onValidFirmware()

googleAnalytics.sendEvent('Board', 'Using', CONFIG.boardIdentifier + ',' + CONFIG.boardVersion);
GUI.log(chrome.i18n.getMessage('boardInfoReceived', [CONFIG.boardIdentifier, CONFIG.boardVersion]));
GUI.log(chrome.i18n.getMessage('targetInfoReceived', [TARGET.fullIdentifier, TARGET.isVariablePitch])); // sibi?

MSP.send_message(MSPCodes.MSP_UID, false, false, function () {

Expand Down
Loading