Skip to content

Commit

Permalink
removed dead variables and make variables static
Browse files Browse the repository at this point in the history
this saves a bunch of flash space and lets the compiler do a better
job of optimising
  • Loading branch information
tridge committed Sep 27, 2024
1 parent 31c11e1 commit 61fc7f0
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 209 deletions.
2 changes: 0 additions & 2 deletions Mcu/f031/Src/stm32f0xx_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ extern void PeriodElapsedCallback();
extern void tenKhzRoutine();
extern char servoPwm;

// extern uint32_t gcr[];
// extern uint8_t gcr_size;
char input_ready = 0;
int update_interupt = 0;
uint8_t update_count = 0;
Expand Down
33 changes: 16 additions & 17 deletions Src/dshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,32 @@
#include "sounds.h"
#include "targets.h"

int dpulse[16] = { 0 };
static int dpulse[16];

const char gcr_encode_table[16] = {
static const char gcr_encode_table[16] = {
0b11001, 0b11011, 0b10010, 0b10011, 0b11101, 0b10101, 0b10110, 0b10111,
0b11010, 0b01001, 0b01010, 0b01011, 0b11110, 0b01101, 0b01110, 0b01111
};

char EDT_ARM_ENABLE = 0;
char EDT_ARM_ENABLE;
char EDT_ARMED = 0;
int shift_amount = 0;
uint32_t gcrnumber;
static int shift_amount;
static uint32_t gcrnumber;
extern int zero_crosses;
extern char send_telemetry;
extern uint8_t max_duty_cycle_change;
int dshot_full_number;
static int dshot_full_number;
extern char play_tone_flag;
uint8_t command_count = 0;
uint8_t last_command = 0;
uint8_t high_pin_count = 0;
uint32_t gcr[37] = { 0 };
uint16_t dshot_frametime;
uint16_t dshot_goodcounts;
uint16_t dshot_badcounts;
char dshot_extended_telemetry = 0;
uint16_t send_extended_dshot = 0;
uint16_t processtime = 0;
uint16_t halfpulsetime = 0;
static uint8_t command_count;
static uint8_t last_command;
static uint8_t high_pin_count;
uint32_t gcr[37];
static uint16_t dshot_frametime;
static uint16_t dshot_goodcounts;
static uint16_t dshot_badcounts;
char dshot_extended_telemetry;
uint16_t send_extended_dshot;
static uint16_t halfpulsetime;

void computeDshotDMA()
{
Expand Down
Loading

0 comments on commit 61fc7f0

Please sign in to comment.