2023-02-18 15:06:28 +00:00
|
|
|
#pragma once
|
|
|
|
#include <Figments.h>
|
|
|
|
#include <ArduinoJson.h>
|
|
|
|
|
|
|
|
struct JsonCoordinateMapping : CoordinateMapping {
|
|
|
|
struct Span {
|
|
|
|
int length = 0;
|
|
|
|
int x = 0;
|
|
|
|
int y = 0;
|
2023-12-26 10:29:49 +00:00
|
|
|
bool reverse = false;
|
|
|
|
|
|
|
|
uint16_t physicalIdx = 0;
|
2023-02-18 15:06:28 +00:00
|
|
|
|
|
|
|
Span() {}
|
2023-12-26 10:29:49 +00:00
|
|
|
Span(int length, int x, int y, bool rev, uint16_t idx) : length(length), x(x), y(y), reverse(rev), physicalIdx(idx) {}
|
2023-02-18 15:06:28 +00:00
|
|
|
};
|
|
|
|
|
2023-12-26 10:29:49 +00:00
|
|
|
uint8_t rotation = 0;
|
|
|
|
|
2023-02-18 15:06:28 +00:00
|
|
|
Span displayMap[32];
|
|
|
|
int strideCount = 0;
|
|
|
|
|
|
|
|
void load(const JsonArray& strides);
|
|
|
|
void loadDefault();
|
|
|
|
|
|
|
|
VirtualCoordinates physicalToVirtualCoords(const PhysicalCoordinates localCoords) const override;
|
|
|
|
PhysicalCoordinates virtualToPhysicalCoords(const VirtualCoordinates virtualCoords) const override;
|
|
|
|
int physicalCoordsToIndex(const PhysicalCoordinates localCoords) const override;
|
|
|
|
unsigned int physicalPixelCount() const override;
|
2023-12-26 10:29:49 +00:00
|
|
|
|
|
|
|
VirtualCoordinates rotate(const VirtualCoordinates coords, uint8_t rotation) const;
|
2023-02-18 15:06:28 +00:00
|
|
|
};
|