Telescope Control Library
PEC.h
- Committer:
- caoyu@caoyuan9642-desktop.MIT.EDU
- Date:
- 2018-09-24
- Revision:
- 19:fd854309cb4c
- Parent:
- 10:e356188d208e
File content as of revision 19:fd854309cb4c:
/* * PEC.h * * Created on: Sep 9, 2018 * Author: caoyu */ #ifndef PUSHTOGO_PEC_H_ #define PUSHTOGO_PEC_H_ #include "mbed.h" // Maximum correctable error per step, in arcsecond #define MAX_PEC_VALUE 20 class Axis; class PEC { public: PEC(Axis &a); virtual ~PEC() { thread->terminate(); delete thread; delete[] pecData; } bool isEnabled() const { return enabled; } void setEnabled(bool enabled) { 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; Thread *thread; float indexOffset; float *pecData; int granularity; void task(); }; #endif /* PUSHTOGO_PEC_H_ */