Skip to content

Commit

Permalink
Merge pull request #144 from 4ms/cmake-preset-pcbversions
Browse files Browse the repository at this point in the history
Cmake preset pcbversions
  • Loading branch information
danngreen authored Oct 20, 2023
2 parents b6157f6 + 137b996 commit 7a83fa1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
10 changes: 9 additions & 1 deletion firmware/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
"value": "ON"
}
}
},
{
"name": "pcb-p12",
"description": "PCB p11 with mods (aka p12)",
"inherits": "base",
"cacheVariables": {
"METAMODULE_PCB_VERSION": "12"
}
}
],
"buildPresets": [
Expand All @@ -40,4 +48,4 @@
"configurePreset": "base"
}
]
}
}
2 changes: 1 addition & 1 deletion firmware/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PRESET := base
PRESET ?= base

# Detect MinGW and use Make
ifdef SYSTEMROOT
Expand Down
4 changes: 4 additions & 0 deletions firmware/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ foreach(brand ${brands})
target_link_libraries(main.elf PRIVATE ${brand}Library)
endforeach()

if (METAMODULE_PCB_VERSION)
target_compile_definitions(main.elf PRIVATE METAMODULE_PCB_VERSION=${METAMODULE_PCB_VERSION})
endif()

add_dependencies(main.elf m4_firmware)

target_link_script(
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/audio/audio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void AudioStream::start() {

AudioConf::SampleT AudioStream::get_audio_output(int output_id) {
auto raw_out = player.get_panel_output(output_id) * mute_ctr;
raw_out = -raw_out / OutputHighRangeVolts;
raw_out = -raw_out / OutputMaxVolts;
auto scaled_out = AudioOutFrame::scaleOutput(raw_out);
return scaled_out;
}
Expand Down
9 changes: 5 additions & 4 deletions firmware/src/medium/conf/scaling_config.hh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ static inline constexpr int32_t InputHighRangeMillivolts = 10310;
static inline constexpr float InputRangeVolts = InputHighRangeVolts - InputLowRangeVolts;
static inline constexpr float InputRangeCenterVolts = (InputHighRangeVolts + InputLowRangeVolts) / 2.f;

static inline constexpr float OutputLowRangeVolts = -8.59f;
static inline constexpr float OutputHighRangeVolts = 8.59f;
static inline constexpr float OutputRangeVolts = OutputHighRangeVolts - OutputLowRangeVolts;
static inline constexpr float OutputRangeCenterVolts = (OutputHighRangeVolts + OutputLowRangeVolts) / 2.f;
#if defined(METAMODULE_PCB_VERSION) && (METAMODULE_PCB_VERSION == 12)
static inline constexpr float OutputMaxVolts = 10.4f;
#else
static inline constexpr float OutputMaxVolts = 8.59f;
#endif

0 comments on commit 7a83fa1

Please sign in to comment.