Skip to content

Commit

Permalink
Conditional compile ts (mck1117#298)
Browse files Browse the repository at this point in the history
* conditionally compile TS as it's a memory hog

* naming so dumps are easier to read
  • Loading branch information
mck1117 authored Nov 23, 2023
1 parent f784d5d commit b239043
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 24 deletions.
15 changes: 10 additions & 5 deletions firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,21 @@ CPPSRC = $(ALLCPPSRC) \
max3185x.cpp \
uart.cpp \
auxout.cpp \
livedata.cpp \
indication.cpp \
console/binary/tunerstudio.cpp \
console/binary/tunerstudio_io.cpp \
console/binary/tunerstudio_io_serial.cpp \
console/binary/tunerstudio_commands.cpp \
sampling_thread.cpp \
heater_thread.cpp \
main.cpp

ifneq ($(ENABLE_TS),)
CPPSRC += console/binary/tunerstudio.cpp \
console/binary/tunerstudio_io.cpp \
console/binary/tunerstudio_io_serial.cpp \
console/binary/tunerstudio_commands.cpp \
livedata.cpp \

DDEFS += -DTS_ENABLED=TRUE
endif

# List ASM source files here.
ASMSRC = $(ALLASMSRC)

Expand Down
24 changes: 12 additions & 12 deletions firmware/boards/f0_module/port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ int InitConfiguration()
return 0;
}

static Configuration c;
static Configuration config;

Configuration* GetConfiguration()
{
Expand All @@ -104,7 +104,7 @@ Configuration* GetConfiguration()
// If config has been written before, use the stored configuration
if (cfg.IsValid())
{
c = cfg;
config = cfg;
}

// Now, override the index with a hardware-strapped option (if present)
Expand All @@ -113,19 +113,19 @@ Configuration* GetConfiguration()

// See https://github.com/mck1117/wideband/issues/11 to explain this madness
switch (3 * sel1 + sel2) {
case 0: c.CanIndexOffset = 2; break;
case 1: c.CanIndexOffset = 0; break;
case 2: c.CanIndexOffset = 3; break;
case 3: c.CanIndexOffset = 4; break;
case 0: config.CanIndexOffset = 2; break;
case 1: config.CanIndexOffset = 0; break;
case 2: config.CanIndexOffset = 3; break;
case 3: config.CanIndexOffset = 4; break;
case 4: /* both floating, do nothing */ break;
case 5: c.CanIndexOffset = 1; break;
case 6: c.CanIndexOffset = 5; break;
case 7: c.CanIndexOffset = 6; break;
case 8: c.CanIndexOffset = 7; break;
case 5: config.CanIndexOffset = 1; break;
case 6: config.CanIndexOffset = 5; break;
case 7: config.CanIndexOffset = 6; break;
case 8: config.CanIndexOffset = 7; break;
default: break;
}

return &c;
return &config;
}

void SetConfiguration()
Expand All @@ -136,7 +136,7 @@ void SetConfiguration()
// Copy data to flash
Flash::Write(
reinterpret_cast<flashaddr_t>(&__configflash__start__),
reinterpret_cast<const uint8_t*>(&c),
reinterpret_cast<const uint8_t*>(&config),
sizeof(Configuration)
);
}
Expand Down
1 change: 1 addition & 0 deletions firmware/boards/f1_dual/board.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
USE_BOOTLOADER = no
ENABLE_TS = yes

MCU = cortex-m3

Expand Down
1 change: 1 addition & 0 deletions firmware/boards/f1_dual_rev1/board.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
USE_BOOTLOADER = no
ENABLE_TS = yes

MCU = cortex-m3

Expand Down
1 change: 1 addition & 0 deletions firmware/boards/f1_rev2/board.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
USE_BOOTLOADER = no
ENABLE_TS = yes

MCU = cortex-m3

Expand Down
1 change: 1 addition & 0 deletions firmware/boards/f1_rev3/board.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
USE_BOOTLOADER = no
ENABLE_TS = yes

MCU = cortex-m3

Expand Down
2 changes: 2 additions & 0 deletions firmware/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ int main() {
StartPumpControl();
InitAuxDac();

#if ENABLE_TS
startTunerStudioConnectivity();
#endif

InitCan();
InitUart();
Expand Down
7 changes: 0 additions & 7 deletions firmware/wideband_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,3 @@
#define HEATER_BATTERY_ON_VOLTAGE 9.5
// mininal battery voltage to continue heating
#define HEATER_BATTETY_OFF_VOLTAGE 8.5

// *******************************
// TunerStudio configuration
// *******************************
#if defined(TS_PRIMARY_UART_PORT) || defined(TS_PRIMARY_SERIAL_PORT)
#define TS_ENABLED
#endif

0 comments on commit b239043

Please sign in to comment.