Skip to content

Commit

Permalink
Merge pull request #18 from MrDham/MrDham-fix-long-calib
Browse files Browse the repository at this point in the history
Add files via upload
  • Loading branch information
MrDham authored Jul 25, 2024
2 parents 0b05d73 + 02803bf commit 355c1fd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Software/Open_Theremin_V4/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
#include "EEPROM.h"

const AppMode AppModeValues[] = {MUTE, NORMAL};
const int16_t CalibrationTolerance = 15;
const int16_t PitchCalibrationTolerance = 15;
const int16_t VolumeCalibrationTolerance = 21;
const int16_t PitchFreqOffset = 700;
const int16_t VolumeFreqOffset = 700;
const int8_t HYST_VAL = 140;
Expand Down Expand Up @@ -462,7 +463,7 @@ void Application::calibrate_pitch()


l_iteration_pitch = 0;
while ((abs(pitchfn0 - pitchfn1) > CalibrationTolerance) && (l_iteration_pitch < 12))
while ((abs(pitchfn0 - pitchfn1) > PitchCalibrationTolerance) && (l_iteration_pitch < 12))
{ // max allowed pitch frequency offset

SPImcpDAC2Asend(pitchXn0);
Expand Down Expand Up @@ -524,7 +525,7 @@ void Application::calibrate_volume()
volumefn1 = GetVolumeMeasurement();

l_iteration_volume = 0;
while ((abs(volumefn0 - volumefn1) > CalibrationTolerance) && (l_iteration_volume < 12))
while ((abs(volumefn0 - volumefn1) > VolumeCalibrationTolerance) && (l_iteration_volume < 12))
{

SPImcpDAC2Bsend(volumeXn0);
Expand Down

0 comments on commit 355c1fd

Please sign in to comment.