mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-13 08:55:39 -04:00
Touch: Migrate touch calibration to persistent memory.
This commit is contained in:
parent
aa1b8f63fc
commit
c424bf08f3
5 changed files with 34 additions and 22 deletions
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue