Skip to content
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
20 changes: 20 additions & 0 deletions js/bluejay_defaults.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
'use strict';

var BLUEJAY_DEFAULTS = {
'204': { // 201 with STARTUP_MELODY
RPM_POWER_SLOPE: 9,
MOTOR_DIRECTION: 1,
COMMUTATION_TIMING: 4,
BEEP_STRENGTH: 40,
BEACON_STRENGTH: 80,
BEACON_DELAY: 4,
DEMAG_COMPENSATION: 2,
TEMPERATURE_PROTECTION: 7,
BRAKE_ON_STOP: 0,
LED_CONTROL: 0,

STARTUP_POWER_MIN: 51,
DITHERING: 1,

STARTUP_POWER_MAX: 25,
STARTUP_MELODY: [2,58,4,32,52,66,13,0,69,45,13,0,52,66,13,0,78,39,211,0,69,45,208,25,52,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
STARTUP_MELODY_WAIT_MS_MSB: 0,
STARTUP_MELODY_WAIT_MS_LSB: 0
},
'203': { // 201 with STARTUP_MELODY
RPM_POWER_SLOPE: 9,
MOTOR_DIRECTION: 1,
Expand Down
6 changes: 4 additions & 2 deletions js/bluejay_eeprom_layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var BLHELI_SILABS_BOOTLOADER_SIZE = 0x0200
var BLHELI_SILABS_FLASH_SIZE = 0x2000
var BLHELI_SILABS_ADDRESS_SPACE_SIZE = BLHELI_SILABS_BOOTLOADER_ADDRESS

var BLHELI_LAYOUT_SIZE = 0xF0
var BLHELI_LAYOUT_SIZE = 0xF2
var BLHELI_MIN_SUPPORTED_LAYOUT_REVISION = 0x13

var BLHELI_S_MIN_LAYOUT_REVISION = 0x20
Expand Down Expand Up @@ -76,7 +76,9 @@ var BLHELI_LAYOUT = {
MCU: { offset: 0x50, size: 16 },
NAME: { offset: 0x60, size: 16 },

STARTUP_MELODY: { offset: 0x70, size: 128 }
STARTUP_MELODY: { offset: 0x70, size: 128 },
STARTUP_MELODY_WAIT_MS_MSB: { offset: 0xF0, size: 1 },
STARTUP_MELODY_WAIT_MS_LSB: { offset: 0xF1, size: 1 }
};

function blheliModeToString(mode) {
Expand Down
7 changes: 7 additions & 0 deletions jsx/blheli_configurator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,14 @@ var Configurator = React.createClass({
},
// @todo add validation of each setting via BLHELI_SETTINGS_DESCRIPTION
writeSetupAll: async function() {
//Update escSettings' wait time after playing back their tune so they all start the dshot beacons at the same time
const melodyDurations = this.state.escSettings.map((s) => { Rtttl.parse(Rtttl.fromBluejayStartupMelody(s.STARTUP_MELODY)).melody.reduce((a, b)=> a + b.duration, 0) });
const maxMelodyDuration = melodyDurations.reduce((a, b) => Math.max(a, b), 0);

for (var esc = 0; esc < this.state.escSettings.length; ++esc) {
const melodyWaitDifference = maxMelodyDuration - melodyDurations[esc];
this.state.escSettings[esc].STARTUP_MELODY_WAIT_MS_MSB = (melodyWaitDifference >> 8) & (2**8 - 1);
this.state.escSettings[esc].STARTUP_MELODY_WAIT_MS_LSB = (melodyWaitDifference) & (2**8 - 1);
await this.writeSetupImpl(esc);
}
},
Expand Down