mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 09:57:50 +00:00
Touch: Migrate touch calibration to persistent memory.
This commit is contained in:
@@ -21,6 +21,9 @@
|
||||
|
||||
#include "touch.hpp"
|
||||
|
||||
#include "portapack_persistent_memory.hpp"
|
||||
using namespace portapack;
|
||||
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace touch {
|
||||
@@ -76,26 +79,14 @@ ui::Point Calibration::translate(const DigitizerPoint& p) const {
|
||||
};
|
||||
}
|
||||
|
||||
static const Calibration _default_calibration {
|
||||
const Calibration default_calibration() {
|
||||
/* Values derived from one PortaPack H1 unit. */
|
||||
{ { { 256, 731 }, { 880, 432 }, { 568, 146 } } },
|
||||
{ { { 32, 48 }, { 208, 168 }, { 120, 288 } } }
|
||||
return {
|
||||
{ { { 256, 731 }, { 880, 432 }, { 568, 146 } } },
|
||||
{ { { 32, 48 }, { 208, 168 }, { 120, 288 } } }
|
||||
};
|
||||
};
|
||||
|
||||
static Calibration _calibration = _default_calibration;
|
||||
|
||||
void set_calibration(const Calibration& value) {
|
||||
_calibration = value;
|
||||
}
|
||||
|
||||
const Calibration& calibration() {
|
||||
return _calibration;
|
||||
}
|
||||
|
||||
const Calibration& default_calibration() {
|
||||
return _default_calibration;
|
||||
}
|
||||
|
||||
void Manager::feed(const Frame& frame) {
|
||||
// touch_debounce.feed(touch_raw);
|
||||
const auto touch_raw = frame.touch;
|
||||
@@ -145,7 +136,7 @@ void Manager::feed(const Frame& frame) {
|
||||
}
|
||||
|
||||
ui::Point Manager::filtered_point() const {
|
||||
return calibration().translate({ filter_x.value(), filter_y.value() });
|
||||
return persistent_memory::touch_calibration().translate({ filter_x.value(), filter_y.value() });
|
||||
}
|
||||
|
||||
} /* namespace touch */
|
||||
|
Reference in New Issue
Block a user