todo: reduce magic constants
This commit is contained in:
parent
abd85cf8dc
commit
717e36a7a4
|
@ -190,17 +190,18 @@ void processLastKnockEvent() {
|
|||
|
||||
float sumSq = 0;
|
||||
|
||||
// todo: reduce magic constants. engineConfiguration->adcVcc?
|
||||
constexpr float ratio = 3.3f / 4095.0f;
|
||||
|
||||
size_t localCount = sampleCount;
|
||||
|
||||
// Prepare the steady state at vcc/2 so that there isn't a step
|
||||
// when samples begin
|
||||
// todo: reduce magic constants. engineConfiguration->adcVcc?
|
||||
knockFilter.cookSteadyState(3.3f / 2);
|
||||
|
||||
// Compute the sum of squares
|
||||
for (size_t i = 0; i < localCount; i++)
|
||||
{
|
||||
for (size_t i = 0; i < localCount; i++) {
|
||||
float volts = ratio * sampleBuffer[i];
|
||||
|
||||
float filtered = knockFilter.filter(volts);
|
||||
|
@ -221,7 +222,7 @@ void processLastKnockEvent() {
|
|||
}
|
||||
|
||||
void KnockThread::ThreadTask() {
|
||||
while(1) {
|
||||
while (1) {
|
||||
chBSemWait(&knockSem);
|
||||
|
||||
ScopePerf perf(PE::SoftwareKnockProcess);
|
||||
|
|
Loading…
Reference in New Issue