Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BufferedSerial FatFileSystemCpp mbed
Diff: FIZ_readers/FIZ_DISNEY.cpp
- Revision:
- 17:5ce3fe98e76d
- Parent:
- 16:a8d3a0dbe4bf
--- a/FIZ_readers/FIZ_DISNEY.cpp Fri Apr 30 11:26:34 2021 +0000
+++ b/FIZ_readers/FIZ_DISNEY.cpp Fri Apr 30 12:21:01 2021 +0000
@@ -22,18 +22,18 @@
void FIZDisney::OnRx(void)
{
- inputBuffer[inputPtr] = _port.getc();
- if (inputPtr==0) {
- if (inputBuffer[inputPtr] == 0x02)
- inputPtr++;
- } else if (inputBuffer[inputPtr] == 0x03) {
- parsePacket();
+ inputBuffer[inputPtr] = _port.getc();
+ if (inputPtr==0) {
+ if (inputBuffer[inputPtr] == 0x02)
+ inputPtr++;
+ } else if (inputBuffer[inputPtr] == 0x03) {
+ parsePacket();
+ inputPtr = 0;
+ } else {
+ inputPtr++;
+ if (inputPtr == InBufferSize)
inputPtr = 0;
- } else {
- inputPtr++;
- if (inputPtr == InBufferSize)
- inputPtr = 0;
- }
+ }
}
void FIZDisney::parsePacket()
@@ -46,18 +46,20 @@
return;
if (inputBuffer[2] != 'C')
return;
- _focus = 0;
- _iris = 0;
- _zoom = 0;
- for (int count = 0;count<6;count++) {
+ _focus = 0;
+ _iris = 0;
+ _zoom = 0;
+ for (int count = 0; count<6; count++) {
_focus*=16;
_focus += hexValue(inputBuffer[5+count]);
}
- for (int count = 0;count<4;count++) {
+ for (int count = 0; count<4; count++) {
_iris*=16;
_iris += hexValue(inputBuffer[11+count]);
_zoom*=16;
_zoom += hexValue(inputBuffer[15+count]);
}
+ // raw iris data is in 10ths of a stop. We want 100ths
+ _iris *= 10;
newData = true;
}