curves now sending/receiving correctly. Y values are now converted to Int16 values to allow handles to dip below 0~
parent
88fec6ef3c
commit
9e3979f4d6
|
|
@ -137,8 +137,9 @@ void setup() {
|
|||
|
||||
// anim.saveToFile("/scurve.anim");
|
||||
// Serial.println("SAVED");
|
||||
handleSaveFile(testPayload, testPayloadLength);
|
||||
anim.loadFromFile("/pointcurve2.anim");
|
||||
//handleSaveFile(testPayload, testPayloadLength);
|
||||
Serial.println("Loading test.anim");
|
||||
anim.loadFromFile("/test.anim");
|
||||
Serial.println(anim.header.frameCount);
|
||||
anim.printCurves();
|
||||
// Serial.print("CurveSegment size: ");
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ uint16_t Animation::getMotorPosition(uint8_t motorID, uint16_t timeCS) {
|
|||
for (const auto& seg : curves[motorID]) {
|
||||
if (timeCS >= seg.startTime && timeCS <= seg.endTime) {
|
||||
// Convert uint16_t to float in range -1 to 1
|
||||
auto toFloat = [](uint16_t v) {
|
||||
auto toFloat = [](int16_t v) {
|
||||
return (float(v) / 65535.0f) * 2.0f - 1.0f;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ struct __attribute__((packed)) CurveSegment {
|
|||
uint16_t startTime;// centiseconds (0.01s) MAX 655.35 seconds
|
||||
uint16_t endTime;// centiseconds (0.01s) MAX 655.35 seconds
|
||||
// remapped from -1 to 1 → 0–65535
|
||||
uint16_t startPointY;
|
||||
int16_t startPointY;
|
||||
uint16_t startHandleX;
|
||||
uint16_t startHandleY;
|
||||
int16_t startHandleY;
|
||||
uint16_t endHandleX;
|
||||
uint16_t endHandleY;
|
||||
uint16_t endPointY;
|
||||
int16_t endHandleY;
|
||||
int16_t endPointY;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue