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

several patches that mean a dramatic power reduction while in idle/armed + neutral #102

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
added USE_LED_PWM to reduce power consumption of green led when armed
When armed and in neutral my afro-esc consumes (with USE_SLEEP=2):
* USE_LED_PWM = 0 - 47.4mA
* USE_LED_PWM = 1 - 43.1mA
* USE_LED_PWM = 2 - 40.9mA (flashes already)
* USE_LED_PWM = 3 - 39.9mA
* USE_LED_PWM = 4 - 39.3mA
* USE_LED_PWM = 5 - 39.1mA
* USE_LED_PWM = 6 - 38.1mA

so there is some power that can get saved by implementing that
  • Loading branch information
msperl committed Nov 3, 2015
commit 98aaf946d961e5fe24bfec891af35dd5fddd5a41
15 changes: 15 additions & 0 deletions tgy.asm
Original file line number Diff line number Diff line change
@@ -204,6 +204,10 @@
.equ DEBUG_ADC_DUMP = 0 ; Output an endless loop of all ADC values (no normal operation)
.equ MOTOR_DEBUG = 0 ; Output sync pulses on MOSI or SCK, debug flag on MISO

.if !defined(USE_LED_PWM)
.equ USE_LED_PWM = 0 ; set to 1/2/3 to set PWM fequency and brightness - 3 flashes already!
.endif

; power saving when the motor is not running
.if !defined(USE_SLEEP)
.equ USE_SLEEP = 0 ; Sleep level to support (0 = none, 1 = idle, 2=adc)
@@ -3757,6 +3761,17 @@ set_brake_duty: ldi2 temp1, temp2, MAX_POWER

wait_for_power_on:
wdr
; GREEN-led PWM based on T1 overflow to save some power
.if USE_LED_PWM && defined(green_led)
lds temp3, tcnt1x
andi temp3, (1<<USE_LED_PWM)-1
brne wait_for_power_blink_green_skip_on
GRN_on
rjmp wait_for_power_blink_green_skip_off
wait_for_power_blink_green_skip_on:
GRN_off
wait_for_power_blink_green_skip_off:
.endif
.if USE_SLEEP
rcall sleep_idle
.endif