@@ -92,19 +92,19 @@ Command_Packet::Command_Packet()
92
92
// creates and parses a response packet from the finger print scanner
93
93
Response_Packet::Response_Packet (uint8_t * buffer)
94
94
{
95
- CheckParsing (buffer[0 ], RESPONSE_START_CODE_1, RESPONSE_START_CODE_1, " RESPONSE_START_CODE_1" );
96
- CheckParsing (buffer[1 ], RESPONSE_START_CODE_2, RESPONSE_START_CODE_2, " RESPONSE_START_CODE_2" );
97
- CheckParsing (buffer[2 ], RESPONSE_DEVICE_ID_1, RESPONSE_DEVICE_ID_1, " RESPONSE_DEVICE_ID_1" );
98
- CheckParsing (buffer[3 ], RESPONSE_DEVICE_ID_2, RESPONSE_DEVICE_ID_2, " RESPONSE_DEVICE_ID_2" );
99
- CheckParsing (buffer[8 ], 0x30 , 0x31 , " AckNak_LOW" );
95
+ CheckParsing (buffer[0 ], RESPONSE_START_CODE_1, RESPONSE_START_CODE_1, F ( " RESPONSE_START_CODE_1" ) );
96
+ CheckParsing (buffer[1 ], RESPONSE_START_CODE_2, RESPONSE_START_CODE_2, F ( " RESPONSE_START_CODE_2" ) );
97
+ CheckParsing (buffer[2 ], RESPONSE_DEVICE_ID_1, RESPONSE_DEVICE_ID_1, F ( " RESPONSE_DEVICE_ID_1" ) );
98
+ CheckParsing (buffer[3 ], RESPONSE_DEVICE_ID_2, RESPONSE_DEVICE_ID_2, F ( " RESPONSE_DEVICE_ID_2" ) );
99
+ CheckParsing (buffer[8 ], 0x30 , 0x31 , F ( " AckNak_LOW" ) );
100
100
if (buffer[8 ] == 0x30 ) ACK = true ; else ACK = false ;
101
- CheckParsing (buffer[9 ], 0x00 , 0x00 , " AckNak_HIGH" );
101
+ CheckParsing (buffer[9 ], 0x00 , 0x00 , F ( " AckNak_HIGH" ) );
102
102
103
103
uint16_t checksum = CalculateChecksum (buffer, 10 );
104
104
uint8_t checksum_low = GetLowByte (checksum);
105
105
uint8_t checksum_high = GetHighByte (checksum);
106
- CheckParsing (buffer[10 ], checksum_low, checksum_low, " Checksum_LOW" );
107
- CheckParsing (buffer[11 ], checksum_high, checksum_high, " Checksum_HIGH" );
106
+ CheckParsing (buffer[10 ], checksum_low, checksum_low, F ( " Checksum_LOW" ) );
107
+ CheckParsing (buffer[11 ], checksum_high, checksum_high, F ( " Checksum_HIGH" ) );
108
108
109
109
Error = ErrorCodes::ParseFromBytes (buffer[5 ], buffer[4 ]);
110
110
@@ -169,19 +169,19 @@ uint32_t Response_Packet::FromParameter()
169
169
}
170
170
171
171
// checks to see if the byte is the proper value, and logs it to the serial channel if not
172
- bool Response_Packet::CheckParsing (uint8_t b, uint8_t propervalue, uint8_t alternatevalue, const char * varname)
172
+ bool Response_Packet::CheckParsing (uint8_t b, uint8_t propervalue, uint8_t alternatevalue, const String varname)
173
173
{
174
174
bool retval = (b != propervalue) && (b != alternatevalue);
175
175
#if FPS_DEBUG
176
176
if (retval)
177
177
{
178
- Serial.print (" Response_Packet parsing error " );
178
+ Serial.print (F ( " Response_Packet parsing error " ) );
179
179
Serial.print (varname);
180
- Serial.print (" " );
180
+ Serial.print (F ( " " ) );
181
181
Serial.print (propervalue, HEX);
182
- Serial.print (" || " );
182
+ Serial.print (F ( " || " ) );
183
183
Serial.print (alternatevalue, HEX);
184
- Serial.print (" != " );
184
+ Serial.print (F ( " != " ) );
185
185
Serial.println (b, HEX);
186
186
}
187
187
#endif
@@ -220,10 +220,10 @@ uint8_t Response_Packet::GetLowByte(uint16_t w)
220
220
Data_Packet::Data_Packet (uint8_t * buffer)
221
221
{
222
222
#if FPS_DEBUG
223
- CheckParsing (buffer[0 ], DATA_START_CODE_1, DATA_START_CODE_1, " DATA_START_CODE_1" );
224
- CheckParsing (buffer[1 ], DATA_START_CODE_2, DATA_START_CODE_2, " DATA_START_CODE_2" );
225
- CheckParsing (buffer[2 ], DATA_DEVICE_ID_1, DATA_DEVICE_ID_1, " DATA_DEVICE_ID_1" );
226
- CheckParsing (buffer[3 ], DATA_DEVICE_ID_2, DATA_DEVICE_ID_2, " DATA_DEVICE_ID_2" );
223
+ CheckParsing (buffer[0 ], DATA_START_CODE_1, DATA_START_CODE_1, F ( " DATA_START_CODE_1" ) );
224
+ CheckParsing (buffer[1 ], DATA_START_CODE_2, DATA_START_CODE_2, F ( " DATA_START_CODE_2" ) );
225
+ CheckParsing (buffer[2 ], DATA_DEVICE_ID_1, DATA_DEVICE_ID_1, F ( " DATA_DEVICE_ID_1" ) );
226
+ CheckParsing (buffer[3 ], DATA_DEVICE_ID_2, DATA_DEVICE_ID_2, F ( " DATA_DEVICE_ID_2" ) );
227
227
228
228
this ->checksum = CalculateChecksum (buffer, 4 );
229
229
#endif
@@ -247,25 +247,25 @@ void Data_Packet::GetLastData(uint8_t buffer[], uint16_t length)
247
247
this ->checksum = CalculateChecksum (buffer, length-2 );
248
248
uint8_t checksum_low = GetLowByte (this ->checksum );
249
249
uint8_t checksum_high = GetHighByte (this ->checksum );
250
- CheckParsing (buffer[length-2 ], checksum_low, checksum_low, " Checksum_LOW" );
251
- CheckParsing (buffer[length-1 ], checksum_high, checksum_high, " Checksum_HIGH" );
250
+ CheckParsing (buffer[length-2 ], checksum_low, checksum_low, F ( " Checksum_LOW" ) );
251
+ CheckParsing (buffer[length-1 ], checksum_high, checksum_high, F ( " Checksum_HIGH" ) );
252
252
#endif
253
253
}
254
254
255
255
// checks to see if the byte is the proper value, and logs it to the serial channel if not
256
- bool Data_Packet::CheckParsing (uint8_t b, uint8_t propervalue, uint8_t alternatevalue, const char * varname)
256
+ bool Data_Packet::CheckParsing (uint8_t b, uint8_t propervalue, uint8_t alternatevalue, const String varname)
257
257
{
258
258
bool retval = (b != propervalue) && (b != alternatevalue);
259
259
#if FPS_DEBUG
260
260
if (retval)
261
261
{
262
- Serial.print (" \n Data_Packet parsing error " );
262
+ Serial.print (F ( " \n Data_Packet parsing error " ) );
263
263
Serial.print (varname);
264
- Serial.print (" " );
264
+ Serial.print (F ( " " ) );
265
265
Serial.print (propervalue, HEX);
266
- Serial.print (" || " );
266
+ Serial.print (F ( " || " ) );
267
267
Serial.print (alternatevalue, HEX);
268
- Serial.print (" != " );
268
+ Serial.print (F ( " != " ) );
269
269
Serial.println (b, HEX);
270
270
}
271
271
#endif
@@ -335,7 +335,7 @@ bool FPS_GT511C3::Open()
335
335
{
336
336
if (!Started) Start ();
337
337
#if FPS_DEBUG
338
- Serial.println (" FPS - Open" );
338
+ Serial.println (F ( " FPS - Open" ) );
339
339
#endif
340
340
Command_Packet* cp = new Command_Packet ();
341
341
cp->Command = Command_Packet::Commands::Open;
@@ -359,7 +359,7 @@ bool FPS_GT511C3::Open()
359
359
void FPS_GT511C3::Close ()
360
360
{
361
361
#if FPS_DEBUG
362
- Serial.println (" FPS - Close" );
362
+ Serial.println (F ( " FPS - Close" ) );
363
363
#endif
364
364
Command_Packet* cp = new Command_Packet ();
365
365
cp->Command = Command_Packet::Commands::Close;
@@ -385,14 +385,14 @@ bool FPS_GT511C3::SetLED(bool on)
385
385
if (on)
386
386
{
387
387
#if FPS_DEBUG
388
- Serial.println (" FPS - LED on" );
388
+ Serial.println (F ( " FPS - LED on" ) );
389
389
#endif
390
390
cp->Parameter [0 ] = 0x01 ;
391
391
}
392
392
else
393
393
{
394
394
#if FPS_DEBUG
395
- Serial.println (" FPS - LED off" );
395
+ Serial.println (F ( " FPS - LED off" ) );
396
396
#endif
397
397
cp->Parameter [0 ] = 0x00 ;
398
398
}
@@ -419,7 +419,7 @@ bool FPS_GT511C3::ChangeBaudRate(uint32_t baud)
419
419
if ((baud == 9600 ) || (baud == 19200 ) || (baud == 38400 ) || (baud == 57600 ) || (baud == 115200 ))
420
420
{
421
421
#if FPS_DEBUG
422
- Serial.println (" FPS - ChangeBaudRate" );
422
+ Serial.println (F ( " FPS - ChangeBaudRate" ) );
423
423
#endif
424
424
Command_Packet* cp = new Command_Packet ();
425
425
cp->Command = Command_Packet::Commands::ChangeBaudRate;
@@ -442,7 +442,7 @@ bool FPS_GT511C3::ChangeBaudRate(uint32_t baud)
442
442
uint16_t FPS_GT511C3::GetEnrollCount ()
443
443
{
444
444
#if FPS_DEBUG
445
- Serial.println (" FPS - GetEnrolledCount" );
445
+ Serial.println (F ( " FPS - GetEnrolledCount" ) );
446
446
#endif
447
447
Command_Packet* cp = new Command_Packet ();
448
448
cp->Command = Command_Packet::Commands::GetEnrollCount;
@@ -467,7 +467,7 @@ uint16_t FPS_GT511C3::GetEnrollCount()
467
467
bool FPS_GT511C3::CheckEnrolled (uint16_t id)
468
468
{
469
469
#if FPS_DEBUG
470
- Serial.println (" FPS - CheckEnrolled" );
470
+ Serial.println (F ( " FPS - CheckEnrolled" ) );
471
471
#endif
472
472
Command_Packet* cp = new Command_Packet ();
473
473
cp->Command = Command_Packet::Commands::CheckEnrolled;
@@ -494,7 +494,7 @@ bool FPS_GT511C3::CheckEnrolled(uint16_t id)
494
494
uint8_t FPS_GT511C3::EnrollStart (uint16_t id)
495
495
{
496
496
#if FPS_DEBUG
497
- Serial.println (" FPS - EnrollStart" );
497
+ Serial.println (F ( " FPS - EnrollStart" ) );
498
498
#endif
499
499
Command_Packet* cp = new Command_Packet ();
500
500
cp->Command = Command_Packet::Commands::EnrollStart;
@@ -524,7 +524,7 @@ uint8_t FPS_GT511C3::EnrollStart(uint16_t id)
524
524
uint8_t FPS_GT511C3::Enroll1 ()
525
525
{
526
526
#if FPS_DEBUG
527
- Serial.println (" FPS - Enroll1" );
527
+ Serial.println (F ( " FPS - Enroll1" ) );
528
528
#endif
529
529
Command_Packet* cp = new Command_Packet ();
530
530
cp->Command = Command_Packet::Commands::Enroll1;
@@ -555,7 +555,7 @@ uint8_t FPS_GT511C3::Enroll1()
555
555
uint8_t FPS_GT511C3::Enroll2 ()
556
556
{
557
557
#if FPS_DEBUG
558
- Serial.println (" FPS - Enroll2" );
558
+ Serial.println (F ( " FPS - Enroll2" ) );
559
559
#endif
560
560
Command_Packet* cp = new Command_Packet ();
561
561
cp->Command = Command_Packet::Commands::Enroll2;
@@ -587,7 +587,7 @@ uint8_t FPS_GT511C3::Enroll2()
587
587
uint8_t FPS_GT511C3::Enroll3 ()
588
588
{
589
589
#if FPS_DEBUG
590
- Serial.println (" FPS - Enroll3" );
590
+ Serial.println (F ( " FPS - Enroll3" ) );
591
591
#endif
592
592
Command_Packet* cp = new Command_Packet ();
593
593
cp->Command = Command_Packet::Commands::Enroll3;
@@ -614,7 +614,7 @@ uint8_t FPS_GT511C3::Enroll3()
614
614
bool FPS_GT511C3::IsPressFinger ()
615
615
{
616
616
#if FPS_DEBUG
617
- Serial.println (" FPS - IsPressFinger" );
617
+ Serial.println (F ( " FPS - IsPressFinger" ) );
618
618
#endif
619
619
Command_Packet* cp = new Command_Packet ();
620
620
cp->Command = Command_Packet::Commands::IsPressFinger;
@@ -636,7 +636,7 @@ bool FPS_GT511C3::IsPressFinger()
636
636
bool FPS_GT511C3::DeleteID (uint16_t id)
637
637
{
638
638
#if FPS_DEBUG
639
- Serial.println (" FPS - DeleteID" );
639
+ Serial.println (F ( " FPS - DeleteID" ) );
640
640
#endif
641
641
Command_Packet* cp = new Command_Packet ();
642
642
cp->Command = Command_Packet::Commands::DeleteID;
@@ -656,7 +656,7 @@ bool FPS_GT511C3::DeleteID(uint16_t id)
656
656
bool FPS_GT511C3::DeleteAll ()
657
657
{
658
658
#if FPS_DEBUG
659
- Serial.println (" FPS - DeleteAll" );
659
+ Serial.println (F ( " FPS - DeleteAll" ) );
660
660
#endif
661
661
Command_Packet* cp = new Command_Packet ();
662
662
cp->Command = Command_Packet::Commands::DeleteAll;
@@ -681,7 +681,7 @@ bool FPS_GT511C3::DeleteAll()
681
681
uint8_t FPS_GT511C3::Verify1_1 (uint16_t id)
682
682
{
683
683
#if FPS_DEBUG
684
- Serial.println (" FPS - Verify1_1" );
684
+ Serial.println (F ( " FPS - Verify1_1" ) );
685
685
#endif
686
686
Command_Packet* cp = new Command_Packet ();
687
687
cp->Command = Command_Packet::Commands::Verify1_1;
@@ -714,7 +714,7 @@ uint8_t FPS_GT511C3::Verify1_1(uint16_t id)
714
714
uint16_t FPS_GT511C3::Identify1_N ()
715
715
{
716
716
#if FPS_DEBUG
717
- Serial.println (" FPS - Identify1_N" );
717
+ Serial.println (F ( " FPS - Identify1_N" ) );
718
718
#endif
719
719
Command_Packet* cp = new Command_Packet ();
720
720
cp->Command = Command_Packet::Commands::Identify1_N;
@@ -738,7 +738,7 @@ uint16_t FPS_GT511C3::Identify1_N()
738
738
bool FPS_GT511C3::CaptureFinger (bool highquality)
739
739
{
740
740
#if FPS_DEBUG
741
- Serial.println (" FPS - CaptureFinger" );
741
+ Serial.println (F ( " FPS - CaptureFinger" ) );
742
742
#endif
743
743
Command_Packet* cp = new Command_Packet ();
744
744
cp->Command = Command_Packet::Commands::CaptureFinger;
@@ -772,7 +772,7 @@ bool FPS_GT511C3::CaptureFinger(bool highquality)
772
772
bool FPS_GT511C3::GetImage (bool patched)
773
773
{
774
774
#if FPS_DEBUG
775
- Serial.println (" FPS - GetImage" );
775
+ Serial.println (F ( " FPS - GetImage" ) );
776
776
#endif
777
777
Command_Packet* cp = new Command_Packet ();
778
778
cp->Command = Command_Packet::Commands::GetImage;
@@ -816,7 +816,7 @@ bool FPS_GT511C3::GetImage(bool patched)
816
816
bool FPS_GT511C3::GetRawImage ()
817
817
{
818
818
#if FPS_DEBUG
819
- Serial.println (" FPS - GetRawImage" );
819
+ Serial.println (F ( " FPS - GetRawImage" ) );
820
820
#endif
821
821
Command_Packet* cp = new Command_Packet ();
822
822
cp->Command = Command_Packet::Commands::GetRawImage;
@@ -840,7 +840,7 @@ bool FPS_GT511C3::GetRawImage()
840
840
uint8_t FPS_GT511C3::GetTemplate (uint16_t id)
841
841
{
842
842
#if FPS_DEBUG
843
- Serial.println (" FPS - GetTemplate" );
843
+ Serial.println (F ( " FPS - GetTemplate" ) );
844
844
#endif
845
845
Command_Packet* cp = new Command_Packet ();
846
846
cp->Command = Command_Packet::Commands::GetTemplate;
@@ -873,7 +873,7 @@ uint8_t FPS_GT511C3::GetTemplate(uint16_t id)
873
873
uint8_t FPS_GT511C3::GetTemplate (uint16_t id, uint8_t data[])
874
874
{
875
875
#if FPS_DEBUG
876
- Serial.println (" FPS - GetTemplate" );
876
+ Serial.println (F ( " FPS - GetTemplate" ) );
877
877
#endif
878
878
Command_Packet* cp = new Command_Packet ();
879
879
cp->Command = Command_Packet::Commands::GetTemplate;
@@ -910,7 +910,7 @@ uint8_t FPS_GT511C3::GetTemplate(uint16_t id, uint8_t data[])
910
910
uint16_t FPS_GT511C3::SetTemplate (byte* tmplt, uint16_t id, bool duplicateCheck)
911
911
{
912
912
#if FPS_DEBUG
913
- Serial.println (" FPS - SetTemplate" );
913
+ Serial.println (F ( " FPS - SetTemplate" ) );
914
914
#endif
915
915
Command_Packet* cp = new Command_Packet ();
916
916
cp->Command = Command_Packet::Commands::SetTemplate;
@@ -994,7 +994,7 @@ void FPS_GT511C3::Start()
994
994
for (uint8_t i = 0 ; i<5 ; i++) // Trying to find FPS baud rate
995
995
{
996
996
#if FPS_DEBUG
997
- Serial.print (" Establishing connection with FPS at baud rate: " );
997
+ Serial.print (F ( " Establishing connection with FPS at baud rate: " ) );
998
998
Serial.print (BaudRates[i]);
999
999
Serial.println ();
1000
1000
#endif
@@ -1050,7 +1050,7 @@ void FPS_GT511C3::Start()
1050
1050
}
1051
1051
1052
1052
#if FPS_DEBUG
1053
- Serial.print (" Connection established succesfully. FPS baud rate was: " );
1053
+ Serial.print (F ( " Connection established succesfully. FPS baud rate was: " ) );
1054
1054
Serial.print (actualBaud);
1055
1055
Serial.println ();
1056
1056
Serial.println ();
@@ -1059,7 +1059,7 @@ void FPS_GT511C3::Start()
1059
1059
if (actualBaud == 0 ) while (true )
1060
1060
{
1061
1061
#if FPS_DEBUG
1062
- Serial.print (" EXCEPTION: FPS didn't answer to communications. Code execution stopped." );
1062
+ Serial.print (F ( " EXCEPTION: FPS didn't answer to communications. Code execution stopped." ) );
1063
1063
Serial.println ();
1064
1064
#endif
1065
1065
delay (1000 ); // Something went terribly wrong with the FPS, and you aren't allowed to leave
@@ -1068,7 +1068,7 @@ void FPS_GT511C3::Start()
1068
1068
if (actualBaud != baud)
1069
1069
{
1070
1070
#if FPS_DEBUG
1071
- Serial.print (" Undesired baud rate. Changing baud rate to: " );
1071
+ Serial.print (F ( " Undesired baud rate. Changing baud rate to: " ) );
1072
1072
Serial.print (baud);
1073
1073
Serial.println ();
1074
1074
Serial.println ();
@@ -1083,7 +1083,7 @@ void FPS_GT511C3::SendCommand(uint8_t cmd[], uint16_t length)
1083
1083
{
1084
1084
_serial.write (cmd, length);
1085
1085
#if FPS_DEBUG
1086
- Serial.print (" FPS - SEND: " );
1086
+ Serial.print (F ( " FPS - SEND: " ) );
1087
1087
SendToSerial (cmd, length);
1088
1088
Serial.println ();
1089
1089
#endif
@@ -1179,16 +1179,16 @@ void FPS_GT511C3::GetData(uint16_t length)
1179
1179
if (_serial.overflow ())
1180
1180
{
1181
1181
#if FPS_DEBUG
1182
- Serial.println (" Overflow! Data download stopped" );
1183
- Serial.println (" Cleaning serial buffer..." );
1182
+ Serial.println (F ( " Overflow! Data download stopped" ) );
1183
+ Serial.println (F ( " Cleaning serial buffer..." ) );
1184
1184
#endif
1185
1185
for (uint16_t j = 0 ; j<length; j++)
1186
1186
{
1187
1187
_serial.read ();
1188
1188
delay (1 );
1189
1189
}
1190
1190
#if FPS_DEBUG
1191
- Serial.println (" Done!" );
1191
+ Serial.println (F ( " Done!" ) );
1192
1192
#endif
1193
1193
return ;
1194
1194
}
@@ -1245,16 +1245,16 @@ bool FPS_GT511C3::ReturnData(uint16_t length, uint8_t data[])
1245
1245
if (_serial.overflow ())
1246
1246
{
1247
1247
#if FPS_DEBUG
1248
- Serial.println (" Overflow! Data download stopped" );
1249
- Serial.println (" Cleaning serial buffer..." );
1248
+ Serial.println (F ( " Overflow! Data download stopped" ) );
1249
+ Serial.println (F ( " Cleaning serial buffer..." ) );
1250
1250
#endif
1251
1251
for (uint16_t j = 0 ; j<length; j++)
1252
1252
{
1253
1253
_serial.read ();
1254
1254
delay (1 );
1255
1255
}
1256
1256
#if FPS_DEBUG
1257
- Serial.println (" Done!" );
1257
+ Serial.println (F ( " Done!" ) );
1258
1258
#endif
1259
1259
return false ;
1260
1260
}
0 commit comments