Telescope Control Library

Dependents:   PushToGo-F429

Revision:
9:d0413a9b1386
Parent:
8:21a33760bf10
Child:
10:e356188d208e
--- a/PEC.h	Sun Sep 09 17:31:20 2018 -0400
+++ b/PEC.h	Mon Sep 10 02:41:05 2018 -0400
@@ -11,13 +11,16 @@
 #include "mbed.h"
 #include "Axis.h"
 
+// Maximum correctable error per step, in arcsecond
+#define MAX_PEC_VALUE 20
+
 class PEC {
 public:
 	PEC(Axis a);
 	virtual ~PEC() {
 		thread->terminate();
 		delete thread;
-		delete []pecData;
+		delete[] pecData;
 	}
 
 	bool isEnabled() const {
@@ -28,6 +31,35 @@
 		this->enabled = enabled;
 	}
 
+	int getSize() const {
+		return granularity;
+	}
+
+	float getPECData(int index) const {
+		if (index >= 0 && index < granularity) {
+			return pecData[index];
+		} else
+			return NAN;
+	}
+
+	void setPECData(int index, float value) {
+		if (index >= 0 && index < granularity && fabsf(value) < MAX_PEC_VALUE) {
+			pecData[index] = value;
+		}
+	}
+
+	float getIndexOffset() const {
+		return indexOffset;
+	}
+
+	/**
+	 * Index offset is the phase on the worm cycle at the reference time for the PEC
+	 * When axis.getAngleDeg() equals indexOffset, the first bin of PEC data will be executed, etc.
+	 */
+	void setIndexOffset(float indexOffset) {
+		this->indexOffset = indexOffset;
+	}
+
 protected:
 	Axis axis;
 	volatile bool enabled;
@@ -41,6 +73,4 @@
 	void task();
 };
 
-
-
 #endif /* PUSHTOGO_PEC_H_ */