File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -1162,12 +1162,12 @@ void FPS_GT511C3::GetData(uint16_t length)
11621162 Data_Packet dp (firstdata);
11631163
11641164 uint16_t numberPacketsNeeded = (length-4 ) / 64 ;
1165- bool smallLastPacket = false ;
11661165 uint8_t lastPacketSize = (length-4 ) % 64 ;
1167- if (lastPacketSize != 0 )
1168- {
1169- numberPacketsNeeded++;
1170- smallLastPacket = true ;
1166+ if (lastPacketSize != 0 ) numberPacketsNeeded++;
1167+ else {
1168+ // Last packet requires special treatment, so you don't want it to pass over the main loop
1169+ numberPacketsNeeded--;
1170+ lastPacketSize = 64 ;
11711171 }
11721172
11731173 uint8_t data[64 ];
@@ -1237,16 +1237,7 @@ bool FPS_GT511C3::ReturnData(uint16_t length, uint8_t data[])
12371237 while (_serial.available () == false ) delay (10 );
12381238 firstdata[i]= (uint8_t ) _serial.read ();
12391239 }
1240- Data_Packet dp (firstdata);
1241-
1242- uint16_t numberPacketsNeeded = (length-4 ) / 64 ;
1243- bool smallLastPacket = false ;
1244- uint8_t lastPacketSize = (length-4 ) % 64 ;
1245- if (lastPacketSize != 0 )
1246- {
1247- numberPacketsNeeded++;
1248- smallLastPacket = true ;
1249- }
1240+ Data_Packet dp (firstdata); // Not needed
12501241
12511242 for (uint16_t i=0 ; i < length-4 ; i++)
12521243 {
You can’t perform that action at this time.
0 commit comments