|
|
@ -1817,7 +1817,7 @@ float pseudo_log_curve(float value) |
|
|
|
// ideas from here: https://forum.pjrc.com/threads/56015-Changing-Volume-Levels-based-on-pot-wheel
|
|
|
|
// ideas from here: https://forum.pjrc.com/threads/56015-Changing-Volume-Levels-based-on-pot-wheel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const float _pseudo_log = 1048575 / (float)(1 << 20); |
|
|
|
//const float _pseudo_log = 1048575 / (float)(1 << 20);
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F("value in: ")); |
|
|
|
Serial.print(F("value in: ")); |
|
|
@ -1827,16 +1827,10 @@ float pseudo_log_curve(float value) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
return (mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0)); |
|
|
|
//return (mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0));
|
|
|
|
|
|
|
|
//return (1 - sqrt(1 - value * value));
|
|
|
|
/*
|
|
|
|
//return (pow(value, 2));
|
|
|
|
float g = mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0); |
|
|
|
return (pow(2, value) - 1); |
|
|
|
|
|
|
|
|
|
|
|
if (g == 0.0) |
|
|
|
|
|
|
|
return (0.001); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return (g); |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc
|
|
|
|
uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc
|
|
|
|