Skip to content

Commit

Permalink
Merge branch 'release/0.21.1-RC1'
Browse files Browse the repository at this point in the history
  • Loading branch information
hyp0dermik-code committed Aug 13, 2024
2 parents 93bf3e1 + 4050c07 commit 1b0802d
Show file tree
Hide file tree
Showing 18 changed files with 289 additions and 430 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/build
/user
/tools/.wine
*.diff
.project
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Current version
TAG := $(shell git describe --tags --abbrev=0)
VERSION ?= $(TAG)
SETTINGSDIR ?= ./src/Settings

# Target parameters
LAYOUTS = A B C D E F G H I J K L M N O P Q R S T U V W Z \
OA
MCUS = H
LAYOUTS_X = A B C
LAYOUTS_X = A B C D E
MCUS_X = X
DEADTIMES = 0 5 10 15 20 25 30 40 50 70 90 120
PWM_FREQS = 24 48 96
Expand Down Expand Up @@ -44,7 +45,6 @@ ASM_INC = \
$(LAYOUTS:%=src/Layouts/%.inc) \
src/Layouts/Base.inc \
src/BLHeliBootLoad.inc \
src/Silabs/SI_EFM8BB1_Defs.inc \
src/Silabs/SI_EFM8BB2_Defs.inc \
src/Silabs/SI_EFM8BB51_Defs.inc \
src/Silabs/SI_EFM8LB1_Defs.inc \
Expand Down Expand Up @@ -93,6 +93,7 @@ $(OUTPUT_DIR)/$(1)_$(2)_$(3)_$(4)_$(VERSION).OBJ : $(ASM_SRC) $(ASM_INC)
@mkdir -p $(OUTPUT_DIR)
@echo "AX51 : $$@"
@$(AX51) $(ASM_SRC) \
"INCDIR($(SETTINGSDIR)) " \
"DEFINE(ESCNO=$(_ESCNO)) " \
"DEFINE(MCU_TYPE=$(_MCU_TYPE)) "\
"DEFINE(DEADTIME=$(_DEADTIME)) "\
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ We are in a very lucky position to have manufacturers who keep helping us out co
* [T-Motor](https://tmotorhobby.com/) - for providing us with an AIO flight-controller
* [TuneRC](https://www.tunerc.com/) - for providing us with AIO flight-controllers
* [weBLEEDfpv](https://webleedfpv.com/) - for a set of "Gore V2" motors
* [HAKRC](https://www.hakrc.com/) - for providing us with ESCs

## Contribute
Any help you can provide is greatly appreciated!
Expand Down
2 changes: 1 addition & 1 deletion src/BLHeliBootLoad.inc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ init:
mov SP, #0c0h ; Stack = 64 upper bytes of RAM
; Initialize clock
mov CLKSEL, #00h ; Set clock divider to 1
IF MCU_TYPE == MCU_BB1 or MCU_TYPE == MCU_BB2
IF MCU_TYPE == MCU_BB2
; Initialize VDD monitor
orl VDM0CN, #080h ; Enable the VDD monitor
ENDIF
Expand Down
63 changes: 12 additions & 51 deletions src/Bluejay.asm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ $include (Modules\Enums.asm)
; PORT 0 | PORT 1 | PWM COM PWM LED
; P0 P1 P2 P3 P4 P5 P6 P7 | P0 P1 P2 P3 P4 P5 P6 P7 | inv inv side n
; ----------------------- | ----------------------- | -------------------------
IF MCU_TYPE == MCU_BB1 or MCU_TYPE == MCU_BB2
IF MCU_TYPE == MCU_BB2
A_ EQU 1 ; Vn Am Bm Cm __ RX __ __ | Ap Ac Bp Bc Cp Cc __ __ | no no high _
B_ EQU 2 ; Vn Am Bm Cm __ RX __ __ | Cc Cp Bc Bp Ac Ap __ __ | no no high _
C_ EQU 3 ; RX __ Vn Am Bm Cm Ap Ac | Bp Bc Cp Cc __ __ __ __ | no no high _
Expand Down Expand Up @@ -116,6 +116,8 @@ IF MCU_TYPE == MCU_BB51
A_ EQU 1 ; __ Bm Cm Am Vn RX __ __ | Ap Ac Bp Bc Cp Cc __ __ | no no low _
B_ EQU 2 ; __ Bm Cm Am Vn RX __ __ | Ac Ap Bc Bp Cc Cp __ __ | no yes high _
C_ EQU 3 ; __ Bm Cm Am Vn RX __ __ | Ac Ap Bc Bp Cc Cp __ __ | yes yes high _
D_ EQU 4 ; __ Bm Cm Am Vn RX __ __ | Ap Ac Bp Bc Cp Cc __ __ | no yes high _
E_ EQU 5 ; __ Cm Bm Am Vn RX __ __ | Cp Bp Ap Cc Bc Ac __ __ | no yes high _
ENDIF

; Select the port mapping to use (or unselect all for use with external batch compile file)
Expand All @@ -134,46 +136,22 @@ ENDIF

PWM_CENTERED EQU DEADTIME > 0 ; Use center aligned pwm on ESCs with dead time

IF MCU_TYPE == MCU_BB1
IS_MCU_48MHZ EQU 0
ELSE
IS_MCU_48MHZ EQU 1
ENDIF
IS_MCU_48MHZ EQU 1

IF PWM_FREQ == PWM_24 or PWM_FREQ == PWM_48 or PWM_FREQ == PWM_96
; Number of bits in pwm high byte
PWM_BITS_H EQU (2 + IS_MCU_48MHZ - PWM_CENTERED - PWM_FREQ)
PWM_BITS_H EQU (3 - PWM_CENTERED - PWM_FREQ)
ENDIF

$include (Modules\McuOffsets.asm)
$include (Modules\Codespace.asm)
$include (Modules\Common.asm)
$include (Modules\Macros.asm)

;**** **** **** **** **** **** **** **** **** **** **** **** ****
; Programming defaults
;**** **** **** **** **** **** **** **** **** **** **** **** ****
DEFAULT_PGM_RPM_POWER_SLOPE EQU 9 ; 0=Off,1..13 (Power limit factor in relation to rpm)
DEFAULT_PGM_COMM_TIMING EQU 4 ; 1=Low 2=MediumLow 3=Medium 4=MediumHigh 5=High
DEFAULT_PGM_DEMAG_COMP EQU 2 ; 1=Disabled 2=Low 3=High
DEFAULT_PGM_DIRECTION EQU 1 ; 1=Normal 2=Reversed 3=Bidir 4=Bidir rev
DEFAULT_PGM_BEEP_STRENGTH EQU 40 ; 0..255 (BLHeli_S is 1..255)
DEFAULT_PGM_BEACON_STRENGTH EQU 80 ; 0..255
DEFAULT_PGM_BEACON_DELAY EQU 4 ; 1=1m 2=2m 3=5m 4=10m 5=Infinite
DEFAULT_PGM_ENABLE_TEMP_PROT EQU 0 ; 0=Disabled 1=80C 2=90C 3=100C 4=110C 5=120C 6=130C 7=140C

DEFAULT_PGM_POWER_RATING EQU 2 ; 1=1S,2=2S+

DEFAULT_PGM_BRAKE_ON_STOP EQU 0 ; 1=Enabled 0=Disabled
DEFAULT_PGM_LED_CONTROL EQU 0 ; Byte for LED control. 2 bits per LED,0=Off,1=On

DEFAULT_PGM_STARTUP_POWER_MIN EQU 21 ; 0..255 => (1000..1125 Throttle): value * (1000 / 2047) + 1000
DEFAULT_PGM_STARTUP_BEEP EQU 1 ; 0=Short beep,1=Melody

DEFAULT_PGM_STARTUP_POWER_MAX EQU 5 ; 0..255 => (1000..2000 Throttle): Maximum startup power
DEFAULT_PGM_BRAKING_STRENGTH EQU 255 ; 0..255 => 0..100 % Braking

DEFAULT_PGM_SAFETY_ARM EQU 0 ; EDT safety arm is disabled by default
; This file is Searched within the INCDIR set in the Makefile.
; This allows overwriting the settings by putting a file with the same name in
; a different directory and setting that in INCDIR.
$include (BluejaySettings.asm)

;**** **** **** **** **** **** **** **** **** **** **** **** ****
; Temporary register definitions
Expand Down Expand Up @@ -401,7 +379,7 @@ Eep_Pgm_Safety_Arm: DB DEFAULT_PGM_SAFETY_ARM ; Various flag settings: bit 0 is

Eep_Dummy: DB 0FFh ; EEPROM address for safety reason
CSEG AT CSEG_NAME
Eep_Name: DB "Bluejay (.0) " ; Name tag (16 Bytes)
Eep_Name: DB "Bluejay (.1 RC1)" ; Name tag (16 Bytes)

CSEG AT CSEG_MELODY
Eep_Pgm_Beep_Melody: DB 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
Expand Down Expand Up @@ -432,7 +410,7 @@ pgm_start:
mov WDTCN, #0DEh ; Disable watchdog (WDT)
mov WDTCN, #0ADh
mov SP, #Stack ; Initialize stack (16 bytes of indirect RAM)
IF MCU_TYPE == MCU_BB1 or MCU_TYPE == MCU_BB2
IF MCU_TYPE == MCU_BB2
orl VDM0CN, #080h ; Enable the VDD monitor
ENDIF
mov RSTSRC, #06h ; Set missing clock and VDD monitor as a reset source if not 1S capable
Expand Down Expand Up @@ -582,21 +560,6 @@ setup_dshot_clear_flags:

setb IE_EA ; Enable all interrupts

; Setup variables for DShot150 (Only on 24MHz because frame length threshold cannot be scaled up)
IF MCU_TYPE == MCU_BB1
mov DShot_Timer_Preset, #-64 ; Load DShot sync timer preset (for DShot150)
mov DShot_Pwm_Thr, #8 ; Load DShot qualification pwm threshold (for DShot150)
mov DShot_Frame_Length_Thr, #160 ; Load DShot frame length criteria

Set_DShot_Tlm_Bitrate 187500 ; = 5/4 * 150000

; Test whether signal is DShot150
mov Rcp_Outside_Range_Cnt, #10 ; Set out of range counter
call wait100ms ; Wait for new RC pulse
mov A, Rcp_Outside_Range_Cnt ; Check if pulses were accepted
jz arming_begin
ENDIF

mov CKCON0, #0Ch ; Timer0/1 clock is system clock (for DShot300/600)

; Setup variables for DShot300
Expand All @@ -612,8 +575,7 @@ ENDIF
mov A, Rcp_Outside_Range_Cnt ; Check if pulses were accepted
jz arming_begin

; Setup variables for DShot600 (Only on 48MHz for performance reasons)
IF MCU_TYPE == MCU_BB2 or MCU_TYPE == MCU_BB51
; Setup variables for DShot600
mov DShot_Timer_Preset, #-64 ; Load DShot sync timer preset (for DShot600)
mov DShot_Pwm_Thr, #8 ; Load DShot pwm threshold (for DShot600)
mov DShot_Frame_Length_Thr, #40 ; Load DShot frame length criteria
Expand All @@ -625,7 +587,6 @@ IF MCU_TYPE == MCU_BB2 or MCU_TYPE == MCU_BB51
call wait100ms ; Wait for new RC pulse
mov A, Rcp_Outside_Range_Cnt ; Check if pulses were accepted
jz arming_begin
ENDIF

; No valid signal detected, try again
ljmp init_no_signal
Expand Down
93 changes: 93 additions & 0 deletions src/Layouts/BB51/D.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
;**** **** **** **** **** **** **** **** **** **** **** **** ****
;
; Bluejay digital ESC firmware for controlling brushless motors in multirotors
;
; Copyright 2022-2022 Chris Landa
; Copyright 2011-2017 Steffen Skaug
;
; This file is part of Bluejay.
;
; Bluejay is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; Bluejay is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with Bluejay. If not, see <http://www.gnu.org/licenses/>.
;
;**** **** **** **** **** **** **** **** **** **** **** **** ****
;
; Hardware definition file "D" for BB51.
;
; PORT 0 | PORT 1 | PWM COM PWM LED
; P0 P1 P2 P3 P4 P5 P6 P7 | P0 P1 P2 P3 P4 P5 P6 P7 | inv inv side n
; ----------------------- | ----------------------- | -------------------------
; __ Bm Cm Am Vn RX __ __ | Ap Ac Bp Bc Cp Cc __ __ | no yes high _
;
;**** **** **** **** **** **** **** **** **** **** **** **** ****

PWM_ACTIVE_HIGH EQU 1 ; Pwm non-inverted
COM_ACTIVE_HIGH EQU 1 ; Damping inverted

COMPARATOR_PORT EQU 0 ; All comparator (mux) pins must be on the same port
COMPARATOR_INVERT EQU 1 ; Comparator output inverted

PCA0CPM_POWER EQU PCA0CPM0
PCA0CPL_POWER EQU PCA0CPL0
PCA0CPH_POWER EQU PCA0CPH0

PCA0CPM_DAMP EQU PCA0CPM1
PCA0CPL_DAMP EQU PCA0CPL1
PCA0CPH_DAMP EQU PCA0CPH1

;**** **** **** **** **** **** **** **** **** **** **** **** ****
; PORT 0 definitions
;**** **** **** **** **** **** **** **** **** **** **** **** ****
; EQU 7
; EQU 6
RTX_PIN EQU 5
V_Mux EQU 4
A_Mux EQU 3
C_Mux EQU 2
B_Mux EQU 1
; EQU 0

P0_DIGITAL EQU NOT((1 SHL A_Mux) + (1 SHL B_Mux) + (1 SHL C_Mux) + (1 SHL V_Mux))
P0_INIT EQU 0FFh
P0_PUSHPULL EQU 0
P0_SKIP EQU 0FFh

;**** **** **** **** **** **** **** **** **** **** **** **** ****
; PORT 1 definitions
;**** **** **** **** **** **** **** **** **** **** **** **** ****
; EQU 7
; EQU 6
C_Com EQU 5
C_Pwm EQU 4
B_Com EQU 3
B_Pwm EQU 2
A_Com EQU 1
A_Pwm EQU 0

P1_DIGITAL EQU (1 SHL A_Pwm) + (1 SHL B_Pwm) + (1 SHL C_Pwm) + (1 SHL A_Com) + (1 SHL B_Com) + (1 SHL C_Com)
P1_INIT EQU (1 SHL A_Pwm) + (1 SHL B_Pwm) + (1 SHL C_Pwm)
P1_PUSHPULL EQU (1 SHL A_Pwm) + (1 SHL B_Pwm) + (1 SHL C_Pwm) + (1 SHL A_Com) + (1 SHL B_Com) + (1 SHL C_Com)
P1_SKIP EQU 0FFh

;**** **** **** **** **** **** **** **** **** **** **** **** ****
; PORT 2 definitions
;**** **** **** **** **** **** **** **** **** **** **** **** ****
DebugPin EQU 0

P2_DIGITAL EQU (1 SHL DebugPin)
P2_PUSHPULL EQU (1 SHL DebugPin)

;**** **** **** **** **** **** **** **** **** **** **** **** ****
; Inherit base layout
;**** **** **** **** **** **** **** **** **** **** **** **** ****
$include (../Base.inc)
94 changes: 94 additions & 0 deletions src/Layouts/BB51/E.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
;**** **** **** **** **** **** **** **** **** **** **** **** ****
;
; Bluejay digital ESC firmware for controlling brushless motors in multirotors
;
; Copyright 2022-2022 Chris Landa
; Copyright 2011-2017 Steffen Skaug
;
; This file is part of Bluejay.
;
; Bluejay is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; Bluejay is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with Bluejay. If not, see <http://www.gnu.org/licenses/>.
;
;**** **** **** **** **** **** **** **** **** **** **** **** ****
;
; Hardware definition file "E" for BB51.
;
; PORT 0 | PORT 1 | PWM COM PWM LED
; P0 P1 P2 P3 P4 P5 P6 P7 | P0 P1 P2 P3 P4 P5 P6 P7 | inv inv side n
; ----------------------- | ----------------------- | -------------------------
; __ Cm Bm Am Vn RX __ __ | Cp Bp Ap Cc Bc Ac __ __ | no yes high _
;
;**** **** **** **** **** **** **** **** **** **** **** **** ****

PWM_ACTIVE_HIGH EQU 1 ; Pwm non-inverted
COM_ACTIVE_HIGH EQU 1 ; Damping inverted

COMPARATOR_PORT EQU 0 ; All comparator (mux) pins must be on the same port
COMPARATOR_INVERT EQU 1 ; Comparator output inverted

PCA0CPM_POWER EQU PCA0CPM0
PCA0CPL_POWER EQU PCA0CPL0
PCA0CPH_POWER EQU PCA0CPH0

PCA0CPM_DAMP EQU PCA0CPM1
PCA0CPL_DAMP EQU PCA0CPL1
PCA0CPH_DAMP EQU PCA0CPH1


;**** **** **** **** **** **** **** **** **** **** **** **** ****
; PORT 0 definitions
;**** **** **** **** **** **** **** **** **** **** **** **** ****
; EQU 7
; EQU 6
RTX_PIN EQU 5
V_Mux EQU 4
A_Mux EQU 3
B_Mux EQU 2
C_Mux EQU 1
; EQU 0

P0_DIGITAL EQU NOT((1 SHL A_Mux) + (1 SHL B_Mux) + (1 SHL C_Mux) + (1 SHL V_Mux))
P0_INIT EQU 0FFh
P0_PUSHPULL EQU 0
P0_SKIP EQU 0FFh

;**** **** **** **** **** **** **** **** **** **** **** **** ****
; PORT 1 definitions
;**** **** **** **** **** **** **** **** **** **** **** **** ****
; EQU 7
; EQU 6
A_Com EQU 5
B_Com EQU 4
C_Com EQU 3
A_Pwm EQU 2
B_Pwm EQU 1
C_Pwm EQU 0

P1_DIGITAL EQU (1 SHL A_Pwm) + (1 SHL B_Pwm) + (1 SHL C_Pwm) + (1 SHL A_Com) + (1 SHL B_Com) + (1 SHL C_Com)
P1_INIT EQU (1 SHL A_Pwm) + (1 SHL B_Pwm) + (1 SHL C_Pwm)
P1_PUSHPULL EQU (1 SHL A_Pwm) + (1 SHL B_Pwm) + (1 SHL C_Pwm) + (1 SHL A_Com) + (1 SHL B_Com) + (1 SHL C_Com)
P1_SKIP EQU 0FFh

;**** **** **** **** **** **** **** **** **** **** **** **** ****
; PORT 2 definitions
;**** **** **** **** **** **** **** **** **** **** **** **** ****
DebugPin EQU 0

P2_DIGITAL EQU (1 SHL DebugPin)
P2_PUSHPULL EQU (1 SHL DebugPin)

;**** **** **** **** **** **** **** **** **** **** **** **** ****
; Inherit base layout
;**** **** **** **** **** **** **** **** **** **** **** **** ****
$include (../Base.inc)
Loading

0 comments on commit 1b0802d

Please sign in to comment.