Template for LPC1768
Dependencies: Gimbal MLX90620 Socket lwip-eth lwip-sys lwip mbed-rtos mbed
Fork of EkkoEye by
CMLX90620.cpp@53:72f350a6d09c, 2016-04-14 (annotated)
- Committer:
- Mike
- Date:
- Thu Apr 14 13:45:38 2016 +0100
- Revision:
- 53:72f350a6d09c
DCW
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mike | 53:72f350a6d09c | 1 | /* |
Mike | 53:72f350a6d09c | 2 | * CMLX90620.cpp |
Mike | 53:72f350a6d09c | 3 | * |
Mike | 53:72f350a6d09c | 4 | * Created on: 12 Mar 2016 |
Mike | 53:72f350a6d09c | 5 | * Author: mike |
Mike | 53:72f350a6d09c | 6 | */ |
Mike | 53:72f350a6d09c | 7 | |
Mike | 53:72f350a6d09c | 8 | //NOTE: "Step Measurement Mode" was removed from new MLX90620 data sheet, page 22 dated Sept 19 2012 |
Mike | 53:72f350a6d09c | 9 | // which is used in this implementation |
Mike | 53:72f350a6d09c | 10 | |
Mike | 53:72f350a6d09c | 11 | #include "mbed.h" |
Mike | 53:72f350a6d09c | 12 | #include "CMLX90620.h" |
Mike | 53:72f350a6d09c | 13 | |
Mike | 53:72f350a6d09c | 14 | extern char* EEbuf; |
Mike | 53:72f350a6d09c | 15 | extern char* RamBuf; |
Mike | 53:72f350a6d09c | 16 | extern char* RamCmmd; //must reside in main.cpp |
Mike | 53:72f350a6d09c | 17 | |
Mike | 53:72f350a6d09c | 18 | const int PTATSENS = 0x90; //ram offset = 0x90, PTAT sensor reading, 16b |
Mike | 53:72f350a6d09c | 19 | const int TGCSENS = 0x91; //ram offset = 0x91, TGC sensor reading, 16b |
Mike | 53:72f350a6d09c | 20 | const int MLXCONFIG = 0x92; //ram offset = 0x92, config register, 16b |
Mike | 53:72f350a6d09c | 21 | const int MLXTRIM = 0x93; //ram offset = 0x93, oscillator trim, lsb>6b of 16b |
Mike | 53:72f350a6d09c | 22 | const int EETRIM = 0xf7; //eep offset = 0xf0, 1 byte, oscillator trim value |
Mike | 53:72f350a6d09c | 23 | |
Mike | 53:72f350a6d09c | 24 | unsigned short Config = 0; //MLX90620 configuration register |
Mike | 53:72f350a6d09c | 25 | unsigned short OscTrim = 0; //MLX90620 oscillator trim register |
Mike | 53:72f350a6d09c | 26 | unsigned short PtatD = 0; //MLX90620 PTAT data register |
Mike | 53:72f350a6d09c | 27 | short VCP = 0; //VCP / TGC |
Mike | 53:72f350a6d09c | 28 | short Vth25X = 0; |
Mike | 53:72f350a6d09c | 29 | float TaXX = 0.0; |
Mike | 53:72f350a6d09c | 30 | |
Mike | 53:72f350a6d09c | 31 | //For To |
Mike | 53:72f350a6d09c | 32 | signed char AcpX = 0; |
Mike | 53:72f350a6d09c | 33 | signed char BcpX = 0; |
Mike | 53:72f350a6d09c | 34 | float Kt1fX = 0.0; |
Mike | 53:72f350a6d09c | 35 | float Kt2fX = 0.0; |
Mike | 53:72f350a6d09c | 36 | signed char TGCX = 0; |
Mike | 53:72f350a6d09c | 37 | char BiScaleX = 0; |
Mike | 53:72f350a6d09c | 38 | unsigned short theta0X = 0; |
Mike | 53:72f350a6d09c | 39 | char theta0ScaleX = 0; |
Mike | 53:72f350a6d09c | 40 | char deltaThetaScaleX = 0; |
Mike | 53:72f350a6d09c | 41 | unsigned short elipsonX = 0; |
Mike | 53:72f350a6d09c | 42 | signed char AiPixelX = 0; //eeprom address range 0x00 - 0x3f |
Mike | 53:72f350a6d09c | 43 | signed char BiPixelX = 0; //eeprom address range 0x40 - 0x7f |
Mike | 53:72f350a6d09c | 44 | char dThetaPixelX = 0; //eeprom address range 0x80 - 0xbf |
Mike | 53:72f350a6d09c | 45 | short VirPixelX = 0; |
Mike | 53:72f350a6d09c | 46 | double TempPxlX = 0; |
Mike | 53:72f350a6d09c | 47 | const int TOINDEX = 0xd4; //eep offset = 0xD4 and 0xE0 (0xD4 + 0x0C), 6 bytes + 6 bytes |
Mike | 53:72f350a6d09c | 48 | const int TAINDEX = 0xda; //eep offset = 0xDA, 6 bytes |
Mike | 53:72f350a6d09c | 49 | |
Mike | 53:72f350a6d09c | 50 | //--------------------------------------------------------------------------------------------------------------------------------------// |
Mike | 53:72f350a6d09c | 51 | // Constructor |
Mike | 53:72f350a6d09c | 52 | |
Mike | 53:72f350a6d09c | 53 | MLX90620::MLX90620(PinName sda, PinName scl, const char* name) : _i2c(sda, scl){ |
Mike | 53:72f350a6d09c | 54 | _i2c.frequency(100000); //set up i2c speed |
Mike | 53:72f350a6d09c | 55 | _i2c.stop(); |
Mike | 53:72f350a6d09c | 56 | |
Mike | 53:72f350a6d09c | 57 | } |
Mike | 53:72f350a6d09c | 58 | |
Mike | 53:72f350a6d09c | 59 | //--------------------------------------------------------------------------------------------------------------------------------------// |
Mike | 53:72f350a6d09c | 60 | //copy contents of EEPROM inside the MLX90620 into a local buffer. Data is used for lookup tables and parameters |
Mike | 53:72f350a6d09c | 61 | |
Mike | 53:72f350a6d09c | 62 | int MLX90620::LoadEEPROM() { |
Mike | 53:72f350a6d09c | 63 | //clear out buffer first |
Mike | 53:72f350a6d09c | 64 | for(int i = 0; i < 256; i++) { |
Mike | 53:72f350a6d09c | 65 | EEbuf[i] = 0; |
Mike | 53:72f350a6d09c | 66 | } |
Mike | 53:72f350a6d09c | 67 | |
Mike | 53:72f350a6d09c | 68 | //load the entire EEPROM |
Mike | 53:72f350a6d09c | 69 | EEbuf[0] = 0; |
Mike | 53:72f350a6d09c | 70 | if(!_i2c.write(0xa0, EEbuf, 1, true)) { //0 returned is ok |
Mike | 53:72f350a6d09c | 71 | _i2c.read(0xa0, EEbuf, 256); //load contents of EEPROM |
Mike | 53:72f350a6d09c | 72 | } else { |
Mike | 53:72f350a6d09c | 73 | _i2c.stop(); |
Mike | 53:72f350a6d09c | 74 | return(1); |
Mike | 53:72f350a6d09c | 75 | } |
Mike | 53:72f350a6d09c | 76 | return(0); |
Mike | 53:72f350a6d09c | 77 | } |
Mike | 53:72f350a6d09c | 78 | |
Mike | 53:72f350a6d09c | 79 | //--------------------------------------------------------------------------------------------------------------------------------------// |
Mike | 53:72f350a6d09c | 80 | //copy oscillator offset from EEbuf to MLX90620 (MS byte = 0) |
Mike | 53:72f350a6d09c | 81 | |
Mike | 53:72f350a6d09c | 82 | int MLX90620::SetOscTrimReg() { |
Mike | 53:72f350a6d09c | 83 | RamCmmd[0] = 4; //command |
Mike | 53:72f350a6d09c | 84 | RamCmmd[1] = EEbuf[EETRIM] - 0xaa; //LS byte check |
Mike | 53:72f350a6d09c | 85 | RamCmmd[2] = EEbuf[EETRIM]; //oscillator trim value |
Mike | 53:72f350a6d09c | 86 | RamCmmd[3] = 0x100 - 0xaa; //MS byte check |
Mike | 53:72f350a6d09c | 87 | RamCmmd[4] = 0; //MS byte = 0 |
Mike | 53:72f350a6d09c | 88 | int r = _i2c.write(0xc0, RamCmmd, 5, false); |
Mike | 53:72f350a6d09c | 89 | return(r); |
Mike | 53:72f350a6d09c | 90 | } |
Mike | 53:72f350a6d09c | 91 | |
Mike | 53:72f350a6d09c | 92 | //--------------------------------------------------------------------------------------------------------------------------------------// |
Mike | 53:72f350a6d09c | 93 | //get oscillator offset register from MLX90620 |
Mike | 53:72f350a6d09c | 94 | |
Mike | 53:72f350a6d09c | 95 | unsigned short MLX90620::GetOscTrimReg() { |
Mike | 53:72f350a6d09c | 96 | RamCmmd[0] = 2; //command |
Mike | 53:72f350a6d09c | 97 | RamCmmd[1] = MLXTRIM; //address of register |
Mike | 53:72f350a6d09c | 98 | RamCmmd[2] = 0; //address step |
Mike | 53:72f350a6d09c | 99 | RamCmmd[3] = 1; //# of reads |
Mike | 53:72f350a6d09c | 100 | _i2c.write(0xc0, RamCmmd, 4, true); |
Mike | 53:72f350a6d09c | 101 | _i2c.read(0xc0, RamCmmd, 2); |
Mike | 53:72f350a6d09c | 102 | OscTrim = (RamCmmd[1] << 8) + RamCmmd[0]; |
Mike | 53:72f350a6d09c | 103 | return(OscTrim); |
Mike | 53:72f350a6d09c | 104 | } |
Mike | 53:72f350a6d09c | 105 | |
Mike | 53:72f350a6d09c | 106 | //--------------------------------------------------------------------------------------------------------------------------------------// |
Mike | 53:72f350a6d09c | 107 | //initialize the configuration register |
Mike | 53:72f350a6d09c | 108 | //******* NOTE: Step measurement mode was removed from new data sheet dated Sept 19 2012 |
Mike | 53:72f350a6d09c | 109 | |
Mike | 53:72f350a6d09c | 110 | int MLX90620::SetConfigReg() { |
Mike | 53:72f350a6d09c | 111 | RamCmmd[0] = 3; //command |
Mike | 53:72f350a6d09c | 112 | // RamCmmd[1] = 0x14c - 0x55; //LS byte check |
Mike | 53:72f350a6d09c | 113 | // RamCmmd[2] = 0x4c; //LS config value, step meas mode, 4Hz array ******* |
Mike | 53:72f350a6d09c | 114 | RamCmmd[1] = 0xf9; //LS byte check |
Mike | 53:72f350a6d09c | 115 | RamCmmd[2] = 0x4e; //LS config value, step meas mode, 4Hz array ******* |
Mike | 53:72f350a6d09c | 116 | RamCmmd[3] = 0x27; //MS byte check |
Mike | 53:72f350a6d09c | 117 | RamCmmd[4] = 0x7c; //MS config value, 2Hz Ta, 400k i2c |
Mike | 53:72f350a6d09c | 118 | int r = _i2c.write(0xc0, RamCmmd, 5, false); |
Mike | 53:72f350a6d09c | 119 | return(r); |
Mike | 53:72f350a6d09c | 120 | } |
Mike | 53:72f350a6d09c | 121 | |
Mike | 53:72f350a6d09c | 122 | //--------------------------------------------------------------------------------------------------------------------------------------// |
Mike | 53:72f350a6d09c | 123 | //get configuration register from MLX90620 |
Mike | 53:72f350a6d09c | 124 | |
Mike | 53:72f350a6d09c | 125 | unsigned short MLX90620::GetConfigReg() { |
Mike | 53:72f350a6d09c | 126 | RamCmmd[0] = 2; //command |
Mike | 53:72f350a6d09c | 127 | RamCmmd[1] = MLXCONFIG; //address of register |
Mike | 53:72f350a6d09c | 128 | RamCmmd[2] = 0; //address step |
Mike | 53:72f350a6d09c | 129 | RamCmmd[3] = 1; //# of reads |
Mike | 53:72f350a6d09c | 130 | _i2c.write(0xc0, RamCmmd, 4, true); |
Mike | 53:72f350a6d09c | 131 | _i2c.read(0xc0, RamCmmd, 2); |
Mike | 53:72f350a6d09c | 132 | Config = (RamCmmd[1] << 8) + RamCmmd[0]; |
Mike | 53:72f350a6d09c | 133 | return(Config); |
Mike | 53:72f350a6d09c | 134 | } |
Mike | 53:72f350a6d09c | 135 | |
Mike | 53:72f350a6d09c | 136 | //--------------------------------------------------------------------------------------------------------------------------------------// |
Mike | 53:72f350a6d09c | 137 | //get PTAT register from MLX90620 |
Mike | 53:72f350a6d09c | 138 | |
Mike | 53:72f350a6d09c | 139 | unsigned short MLX90620::GetPTATReg() { |
Mike | 53:72f350a6d09c | 140 | RamCmmd[0] = 2; //command |
Mike | 53:72f350a6d09c | 141 | RamCmmd[1] = PTATSENS; //address of register |
Mike | 53:72f350a6d09c | 142 | RamCmmd[2] = 0; //address step |
Mike | 53:72f350a6d09c | 143 | RamCmmd[3] = 1; //# of reads |
Mike | 53:72f350a6d09c | 144 | _i2c.write(0xc0, RamCmmd, 4, true); |
Mike | 53:72f350a6d09c | 145 | _i2c.read(0xc0, RamCmmd, 2); |
Mike | 53:72f350a6d09c | 146 | PtatD = (RamCmmd[1] << 8) + RamCmmd[0]; |
Mike | 53:72f350a6d09c | 147 | return(PtatD); |
Mike | 53:72f350a6d09c | 148 | } |
Mike | 53:72f350a6d09c | 149 | |
Mike | 53:72f350a6d09c | 150 | //--------------------------------------------------------------------------------------------------------------------------------------// |
Mike | 53:72f350a6d09c | 151 | //get VCP / TGC register from MLX90620 |
Mike | 53:72f350a6d09c | 152 | |
Mike | 53:72f350a6d09c | 153 | short MLX90620::GetTGCReg() { |
Mike | 53:72f350a6d09c | 154 | RamCmmd[0] = 2; //command |
Mike | 53:72f350a6d09c | 155 | RamCmmd[1] = TGCSENS; //address of register |
Mike | 53:72f350a6d09c | 156 | RamCmmd[2] = 0; //address step |
Mike | 53:72f350a6d09c | 157 | RamCmmd[3] = 1; //# of reads |
Mike | 53:72f350a6d09c | 158 | _i2c.write(0xc0, RamCmmd, 4, true); |
Mike | 53:72f350a6d09c | 159 | _i2c.read(0xc0, RamCmmd, 2); |
Mike | 53:72f350a6d09c | 160 | VCP = (RamCmmd[1] << 8) + RamCmmd[0]; |
Mike | 53:72f350a6d09c | 161 | return(VCP); |
Mike | 53:72f350a6d09c | 162 | } |
Mike | 53:72f350a6d09c | 163 | |
Mike | 53:72f350a6d09c | 164 | //--------------------------------------------------------------------------------------------------------------------------------------// |
Mike | 53:72f350a6d09c | 165 | //get RAM dump from MLX90620 |
Mike | 53:72f350a6d09c | 166 | bool firstDump = false; |
Mike | 53:72f350a6d09c | 167 | |
Mike | 53:72f350a6d09c | 168 | void MLX90620::LoadMLXRam() { |
Mike | 53:72f350a6d09c | 169 | RamCmmd[0] = 2; //command |
Mike | 53:72f350a6d09c | 170 | RamCmmd[1] = 0; //start address |
Mike | 53:72f350a6d09c | 171 | RamCmmd[2] = 1; //address step |
Mike | 53:72f350a6d09c | 172 | RamCmmd[3] = 0x40; //# of reads |
Mike | 53:72f350a6d09c | 173 | _i2c.write(0xc0, RamCmmd, 4, true); |
Mike | 53:72f350a6d09c | 174 | _i2c.read(0xc0, RamBuf, 0x80); |
Mike | 53:72f350a6d09c | 175 | PtatD = MLX90620::GetPTATReg(); |
Mike | 53:72f350a6d09c | 176 | VCP = MLX90620::GetTGCReg(); |
Mike | 53:72f350a6d09c | 177 | } |
Mike | 53:72f350a6d09c | 178 | |
Mike | 53:72f350a6d09c | 179 | //--------------------------------------------------------------------------------------------------------------------------------------// |
Mike | 53:72f350a6d09c | 180 | //start measurement MLX90620 |
Mike | 53:72f350a6d09c | 181 | |
Mike | 53:72f350a6d09c | 182 | int MLX90620::StartMeasurement() { |
Mike | 53:72f350a6d09c | 183 | RamCmmd[0] = 1; //command |
Mike | 53:72f350a6d09c | 184 | RamCmmd[1] = 8; //address of config register |
Mike | 53:72f350a6d09c | 185 | |
Mike | 53:72f350a6d09c | 186 | int r = _i2c.write(0xc0, RamCmmd, 2, false); |
Mike | 53:72f350a6d09c | 187 | return(r); |
Mike | 53:72f350a6d09c | 188 | } |
Mike | 53:72f350a6d09c | 189 | |
Mike | 53:72f350a6d09c | 190 | //--------------------------------------------------------------------------------------------------------------------------------------// |
Mike | 53:72f350a6d09c | 191 | // Initial Calculations for Ta and To |
Mike | 53:72f350a6d09c | 192 | |
Mike | 53:72f350a6d09c | 193 | float MLX90620::GetDieTemp() { |
Mike | 53:72f350a6d09c | 194 | PtatD = MLX90620::GetPTATReg(); |
Mike | 53:72f350a6d09c | 195 | float TaX = (-Kt1fX + sqrtf(powf(Kt1fX, 2.0) - 4.0 * Kt2fX * (Vth25X - PtatD)))/(2.0 * Kt2fX) + 25.0; |
Mike | 53:72f350a6d09c | 196 | return(TaX); |
Mike | 53:72f350a6d09c | 197 | } |
Mike | 53:72f350a6d09c | 198 | |
Mike | 53:72f350a6d09c | 199 | //--------------------------------------------------------------------------------------------------------------------------------------// |
Mike | 53:72f350a6d09c | 200 | // Initial Calculations for Ta and To |
Mike | 53:72f350a6d09c | 201 | |
Mike | 53:72f350a6d09c | 202 | void MLX90620::CalcTa_To() { |
Mike | 53:72f350a6d09c | 203 | //Calculate Ta first |
Mike | 53:72f350a6d09c | 204 | Vth25X = (EEbuf[TAINDEX + 1] << 8) + EEbuf[TAINDEX + 0]; |
Mike | 53:72f350a6d09c | 205 | short Kt1 = (EEbuf[TAINDEX + 3] << 8) + EEbuf[TAINDEX + 2]; |
Mike | 53:72f350a6d09c | 206 | short Kt2 = (EEbuf[TAINDEX + 5] << 8) + EEbuf[TAINDEX + 4]; |
Mike | 53:72f350a6d09c | 207 | Kt1fX = Kt1 / 1024.0; |
Mike | 53:72f350a6d09c | 208 | Kt2fX = Kt2 / 1048576.0; |
Mike | 53:72f350a6d09c | 209 | TaXX = MLX90620::GetDieTemp(); |
Mike | 53:72f350a6d09c | 210 | |
Mike | 53:72f350a6d09c | 211 | //Calculate To |
Mike | 53:72f350a6d09c | 212 | AcpX = EEbuf[TOINDEX + 0]; |
Mike | 53:72f350a6d09c | 213 | BcpX = EEbuf[TOINDEX + 1]; |
Mike | 53:72f350a6d09c | 214 | // unsigned short thetaCPX = (EEbuf[TOINDEX + 3] << 8) + EEbuf[TOINDEX + 2]; |
Mike | 53:72f350a6d09c | 215 | TGCX = EEbuf[TOINDEX + 4]; |
Mike | 53:72f350a6d09c | 216 | BiScaleX = EEbuf[TOINDEX + 5]; |
Mike | 53:72f350a6d09c | 217 | theta0X = (EEbuf[TOINDEX + 13] << 8) + EEbuf[TOINDEX + 12]; |
Mike | 53:72f350a6d09c | 218 | theta0ScaleX = EEbuf[TOINDEX + 14]; |
Mike | 53:72f350a6d09c | 219 | deltaThetaScaleX = EEbuf[TOINDEX + 15]; |
Mike | 53:72f350a6d09c | 220 | elipsonX = (EEbuf[TOINDEX + 17] << 8) + EEbuf[TOINDEX + 16]; |
Mike | 53:72f350a6d09c | 221 | /* |
Mike | 53:72f350a6d09c | 222 | printf("Vth(25) = %6d 0x%x\nTa1 = %6d 0x%x\nTa2 = %6d 0x%x\n", Vth25X, Vth25X, Kt1, Kt1, Kt2, Kt2); |
Mike | 53:72f350a6d09c | 223 | printf("Kt1fX = %f\nKt2fX = %f\nTaXX = %f\n\n", Kt1fX, Kt2fX, TaXX); |
Mike | 53:72f350a6d09c | 224 | printf("Acp = %6d 0x%x\nBcp = %6d 0x%x\nThCP = %6d 0x%x\n", AcpX, AcpX, BcpX, BcpX, thetaCPX, thetaCPX); |
Mike | 53:72f350a6d09c | 225 | printf("TGC = %6d 0x%x\nBiS = %6d 0x%x\nTh0 = %6d 0x%x\n", TGCX, TGCX, BiScaleX, BiScaleX, theta0X, theta0X); |
Mike | 53:72f350a6d09c | 226 | printf("T0s = %6d 0x%x\nDts = %6d 0x%x\nelip = %6d 0x%x\n\n", theta0ScaleX, theta0ScaleX, deltaThetaScaleX, deltaThetaScaleX, elipsonX, elipsonX); |
Mike | 53:72f350a6d09c | 227 | */ |
Mike | 53:72f350a6d09c | 228 | } |
Mike | 53:72f350a6d09c | 229 | |
Mike | 53:72f350a6d09c | 230 | //--------------------------------------------------------------------------------------------------------------------------------------// |
Mike | 53:72f350a6d09c | 231 | // Pixel Temperature Calculation |
Mike | 53:72f350a6d09c | 232 | |
Mike | 53:72f350a6d09c | 233 | double MLX90620::CalcPixel(int Pixel) { |
Mike | 53:72f350a6d09c | 234 | AiPixelX = EEbuf[Pixel]; //eeprom address range 0x00 - 0x3f |
Mike | 53:72f350a6d09c | 235 | BiPixelX = EEbuf[Pixel + 0x40]; //eeprom address range 0x40 - 0x7f |
Mike | 53:72f350a6d09c | 236 | dThetaPixelX = EEbuf[Pixel + 0x80]; //eeprom address range 0x08 - 0xbf |
Mike | 53:72f350a6d09c | 237 | VirPixelX = (RamBuf[Pixel * 2 + 1] << 8) + RamBuf[Pixel * 2]; //ram address range 0x000 - 0x08f, 16b |
Mike | 53:72f350a6d09c | 238 | float Vcp_off_comp = VCP - (AcpX + BcpX / powf(2.0,BiScaleX) * (TaXX - 25.0)); |
Mike | 53:72f350a6d09c | 239 | float VirPixel_off_comp = VirPixelX - (AiPixelX + BiPixelX / powf(2.0,BiScaleX) * (TaXX - 25.0)); |
Mike | 53:72f350a6d09c | 240 | float VirPixel_off_comp2 = (float(AiPixelX) + float(BiPixelX) / float(1 << BiScaleX) * (TaXX - 25.0)); |
Mike | 53:72f350a6d09c | 241 | VirPixel_off_comp2 = VirPixelX - VirPixel_off_comp2; |
Mike | 53:72f350a6d09c | 242 | float VirPixel_tgc_comp = VirPixel_off_comp - TGCX / 32.0 * Vcp_off_comp; |
Mike | 53:72f350a6d09c | 243 | float elipsonf = elipsonX / 32768.0; |
Mike | 53:72f350a6d09c | 244 | float VirPixel_comp = VirPixel_tgc_comp / elipsonf; |
Mike | 53:72f350a6d09c | 245 | double theta28 = theta0X / powf(2.0, theta0ScaleX) + dThetaPixelX / powf(2.0, deltaThetaScaleX); |
Mike | 53:72f350a6d09c | 246 | double TempPxl = powf((VirPixel_comp / theta28 + powf((TaXX + 273.15), 4.0)), (1.0 / 4.0)) - 273.15; |
Mike | 53:72f350a6d09c | 247 | /* |
Mike | 53:72f350a6d09c | 248 | printf("pixel = %d\n", Pixel); |
Mike | 53:72f350a6d09c | 249 | printf("Acp = %d\nBcp = %d\nBiS = %d\n", AcpX, BcpX, BiScaleX); |
Mike | 53:72f350a6d09c | 250 | printf("Vcp = %d\neps = %d\nTGC = %d\n", VCP, elipsonX, TGCX); |
Mike | 53:72f350a6d09c | 251 | printf("Vcp_off_comp = %f\n", Vcp_off_comp); |
Mike | 53:72f350a6d09c | 252 | printf("VirPixel_off_comp = %f\n", VirPixel_off_comp); |
Mike | 53:72f350a6d09c | 253 | printf("VirPixel = %d\n", VirPixelX); |
Mike | 53:72f350a6d09c | 254 | printf("AiPixel = %d\n", AiPixelX); |
Mike | 53:72f350a6d09c | 255 | printf("BiPixel = %d\n", BiPixelX); |
Mike | 53:72f350a6d09c | 256 | printf("BiScale = %d\n", BiScaleX); |
Mike | 53:72f350a6d09c | 257 | printf("2^BiScale = %f\n", (powf(2.0,BiScaleX))); |
Mike | 53:72f350a6d09c | 258 | printf("1 << BiScale = %d\n", (1 << BiScaleX)); |
Mike | 53:72f350a6d09c | 259 | printf("Ta-25.0 = %f\n", (TaXX - 25.0)); |
Mike | 53:72f350a6d09c | 260 | printf("BiPix/2^BiScale = %f\n", (BiPixelX / powf(2.0,BiScaleX))); |
Mike | 53:72f350a6d09c | 261 | printf("AiP+BiP/2^BiScale)*(Ta-25= %f\n", (AiPixelX + BiPixelX / powf(2.0,BiScaleX) * (TaXX - 25.0))); |
Mike | 53:72f350a6d09c | 262 | printf("VirPixel_off_comp again = %f\n", (VirPixelX - (AiPixelX + BiPixelX / powf(2.0,BiScaleX) * (TaXX - 25.0)))); |
Mike | 53:72f350a6d09c | 263 | printf("VirPixel_off_comp2 step = %f\n", VirPixel_off_comp2); |
Mike | 53:72f350a6d09c | 264 | printf("VirPixel_tgc_comp = %f\n", VirPixel_tgc_comp); |
Mike | 53:72f350a6d09c | 265 | printf("elipsonf = %f\n", elipsonf); |
Mike | 53:72f350a6d09c | 266 | printf("VirPixel_comp = %f\n", VirPixel_comp); |
Mike | 53:72f350a6d09c | 267 | printf("theta28 = %f << double print problem\n", (theta28 * 100000000.0)); //<<< can't print a double |
Mike | 53:72f350a6d09c | 268 | printf("TempPxl = %f\n", TempPxl); |
Mike | 53:72f350a6d09c | 269 | */ |
Mike | 53:72f350a6d09c | 270 | return(TempPxl); |
Mike | 53:72f350a6d09c | 271 | } |
Mike | 53:72f350a6d09c | 272 | |
Mike | 53:72f350a6d09c | 273 | |
Mike | 53:72f350a6d09c | 274 | |
Mike | 53:72f350a6d09c | 275 |