.

Dependents:  

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Unwrapper.cpp Source File

Unwrapper.cpp

00001 /*  
00002 */
00003 
00004 #include "Unwrapper.h"
00005 #define   pi 3.141592653589793
00006 using namespace std;
00007 
00008 Unwrapper::Unwrapper(double i2r)
00009 {   
00010     inc2rad = i2r;
00011     last_value = 0;
00012 }
00013 
00014 Unwrapper::~Unwrapper() {}
00015 
00016 void Unwrapper::reset(void)
00017 {
00018     last_value = 0;
00019 }
00020 
00021 double Unwrapper::doStep(short inc)
00022 {
00023     long temp = inc;
00024     if((temp - last_value) > 32000)
00025         temp -= 0xFFFF;
00026     else if((temp - last_value) < -32000)
00027         temp += 0xFFFF;
00028     last_value = temp;
00029     return (temp*inc2rad);
00030 }