Skip to content

Commit 3932186

Browse files
committed
Fix warnings
- extra tokens at end of #include directive - ignoring #pragma region - deprecated conversion from string constant to 'char*' - no return statement in function returning non-void - comparison is always false due to limited range of data type
1 parent 3544fbe commit 3932186

File tree

2 files changed

+67
-9
lines changed

2 files changed

+67
-9
lines changed

FPS_GT511C3/FPS_GT511C3.cpp

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
TLDR; Wil Wheaton's Law
77
*/
88

9-
#include "FPS_GT511C3.h";
9+
#include "FPS_GT511C3.h"
1010

11+
#ifndef __GNUC__
1112
#pragma region -= Command_Packet Definitions =-
13+
#endif //__GNUC__
1214

1315
// returns the 12 bytes of the generated command packet
1416
// remember to call delete on the returned array
@@ -80,9 +82,13 @@ word Command_Packet::_CalculateChecksum()
8082
Command_Packet::Command_Packet()
8183
{
8284
};
85+
#ifndef __GNUC__
8386
#pragma endregion
87+
#endif //__GNUC__
8488

89+
#ifndef __GNUC__
8590
#pragma region -= Response_Packet Definitions =-
91+
#endif //__GNUC__
8692
// creates and parses a response packet from the finger print scanner
8793
Response_Packet::Response_Packet(byte* buffer, bool UseSerialDebug)
8894
{
@@ -186,7 +192,7 @@ byte Response_Packet::GetLowByte(word w)
186192
}
187193

188194
// checks to see if the byte is the proper value, and logs it to the serial channel if not
189-
bool Response_Packet::CheckParsing(byte b, byte propervalue, byte alternatevalue, char* varname, bool UseSerialDebug)
195+
bool Response_Packet::CheckParsing(byte b, byte propervalue, byte alternatevalue, const char* varname, bool UseSerialDebug)
190196
{
191197
bool retval = (b != propervalue) && (b != alternatevalue);
192198
if ((UseSerialDebug) && (retval))
@@ -200,21 +206,31 @@ bool Response_Packet::CheckParsing(byte b, byte propervalue, byte alternatevalue
200206
Serial.print(" != ");
201207
Serial.println(b, HEX);
202208
}
203-
209+
return retval;
204210
}
211+
#ifndef __GNUC__
205212
#pragma endregion
213+
#endif //__GNUC__
206214

215+
#ifndef __GNUC__
207216
#pragma region -= Data_Packet =-
217+
#endif //__GNUC__
208218
//void Data_Packet::StartNewPacket()
209219
//{
210220
// Data_Packet::NextPacketID = 0;
211221
// Data_Packet::CheckSum = 0;
212222
//}
223+
#ifndef __GNUC__
213224
#pragma endregion
225+
#endif //__GNUC__
214226

227+
#ifndef __GNUC__
215228
#pragma region -= FPS_GT511C3 Definitions =-
229+
#endif //__GNUC__
216230

231+
#ifndef __GNUC__
217232
#pragma region -= Constructor/Destructor =-
233+
#endif //__GNUC__
218234
// Creates a new object to interface with the fingerprint scanner
219235
FPS_GT511C3::FPS_GT511C3(uint8_t rx, uint8_t tx)
220236
: _serial(rx,tx)
@@ -230,9 +246,13 @@ FPS_GT511C3::~FPS_GT511C3()
230246
{
231247
_serial.~SoftwareSerial();
232248
}
249+
#ifndef __GNUC__
233250
#pragma endregion
251+
#endif //__GNUC__
234252

253+
#ifndef __GNUC__
235254
#pragma region -= Device Commands =-
255+
#endif //__GNUC__
236256
//Initialises the device and gets ready for commands
237257
void FPS_GT511C3::Open()
238258
{
@@ -305,7 +325,7 @@ bool FPS_GT511C3::SetLED(bool on)
305325
// Parameter: 9600, 19200, 38400, 57600, 115200
306326
// Returns: True if success, false if invalid baud
307327
// NOTE: Untested (don't have a logic level changer and a voltage divider is too slow)
308-
bool FPS_GT511C3::ChangeBaudRate(int baud)
328+
bool FPS_GT511C3::ChangeBaudRate(unsigned long baud)
309329
{
310330
if ((baud == 9600) || (baud == 19200) || (baud == 38400) || (baud == 57600) || (baud == 115200))
311331
{
@@ -619,9 +639,13 @@ bool FPS_GT511C3::CaptureFinger(bool highquality)
619639
return retval;
620640

621641
}
642+
#ifndef __GNUC__
622643
#pragma endregion
644+
#endif //__GNUC__
623645

646+
#ifndef __GNUC__
624647
#pragma region -= Not imlemented commands =-
648+
#endif //__GNUC__
625649
// Gets an image that is 258x202 (52116 bytes) and returns it in 407 Data_Packets
626650
// Use StartDataDownload, and then GetNextDataPacket until done
627651
// Returns: True (device confirming download starting)
@@ -709,10 +733,14 @@ bool FPS_GT511C3::CaptureFinger(bool highquality)
709733
// UpgradeISOCDImage - Data sheet says not supported
710734
// SetIAPMode - for upgrading firmware (which data sheet says is not supported)
711735
// Ack and Nack are listed as commands for some unknown reason... not implemented
736+
#ifndef __GNUC__
712737
#pragma endregion
738+
#endif //__GNUC__
713739

714740

741+
#ifndef __GNUC__
715742
#pragma region -= Private Methods =-
743+
#endif //__GNUC__
716744
// Sends the command to the software serial channel
717745
void FPS_GT511C3::SendCommand(byte cmd[], int length)
718746
{
@@ -778,7 +806,11 @@ void FPS_GT511C3::serialPrintHex(byte data)
778806
sprintf(tmp, "%.2X",data);
779807
Serial.print(tmp);
780808
}
809+
#ifndef __GNUC__
781810
#pragma endregion
811+
#endif //__GNUC__
782812

813+
#ifndef __GNUC__
783814
#pragma endregion
815+
#endif //__GNUC__
784816

FPS_GT511C3/FPS_GT511C3.h

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
#ifndef FPS_GT511C3_h
1010
#define FPS_GT511C3_h
1111

12-
#include "Arduino.h";
13-
#include "SoftwareSerial.h";
12+
#include "Arduino.h"
13+
#include "SoftwareSerial.h"
14+
#ifndef __GNUC__
1415
#pragma region -= Command_Packet =-
16+
#endif //__GNUC__
1517
/*
1618
Command_Packet represents the 12 byte command that we send to the finger print scanner
1719
*/
@@ -76,9 +78,13 @@ class Command_Packet
7678
byte GetHighByte(word w);
7779
byte GetLowByte(word w);
7880
};
81+
#ifndef __GNUC__
7982
#pragma endregion
83+
#endif //__GNUC__
8084

85+
#ifndef __GNUC__
8186
#pragma region -= Response_Packet =-
87+
#endif //__GNUC__
8288
/*
8389
Response_Packet represents the returned data from the finger print scanner
8490
*/
@@ -127,14 +133,18 @@ class Response_Packet
127133
int IntFromParameter();
128134

129135
private:
130-
bool CheckParsing(byte b, byte propervalue, byte alternatevalue, char* varname, bool UseSerialDebug);
136+
bool CheckParsing(byte b, byte propervalue, byte alternatevalue, const char* varname, bool UseSerialDebug);
131137
word CalculateChecksum(byte* buffer, int length);
132138
byte GetHighByte(word w);
133139
byte GetLowByte(word w);
134140
};
141+
#ifndef __GNUC__
135142
#pragma endregion
143+
#endif //__GNUC__
136144

145+
#ifndef __GNUC__
137146
#pragma region -= Data_Packet =-
147+
#endif //__GNUC__
138148
// Data Mule packet for receiving large data(in 128 byte pieces) from the FPS
139149
// This class can only transmit one packet at a time
140150
//class Data_Packet
@@ -149,7 +159,9 @@ class Response_Packet
149159
//private:
150160
// static int NextPacketID;
151161
//};
162+
#ifndef __GNUC__
152163
#pragma endregion
164+
#endif //__GNUC__
153165

154166

155167
/*
@@ -162,16 +174,22 @@ class FPS_GT511C3
162174
// Enables verbose debug output using hardware Serial
163175
bool UseSerialDebug;
164176

177+
#ifndef __GNUC__
165178
#pragma region -= Constructor/Destructor =-
179+
#endif //__GNUC__
166180
// Creates a new object to interface with the fingerprint scanner
167181
FPS_GT511C3(uint8_t rx, uint8_t tx);
168182

169183
// destructor
170184
~FPS_GT511C3();
185+
#ifndef __GNUC__
171186
#pragma endregion
187+
#endif //__GNUC__
172188

173189

190+
#ifndef __GNUC__
174191
#pragma region -= Device Commands =-
192+
#endif //__GNUC__
175193
//Initialises the device and gets ready for commands
176194
void Open();
177195

@@ -189,7 +207,7 @@ class FPS_GT511C3
189207
// Parameter: 9600 - 115200
190208
// Returns: True if success, false if invalid baud
191209
// NOTE: Untested (don't have a logic level changer and a voltage divider is too slow)
192-
bool ChangeBaudRate(int baud);
210+
bool ChangeBaudRate(unsigned long baud);
193211

194212
// Gets the number of enrolled fingerprints
195213
// Return: The total number of enrolled fingerprints
@@ -266,9 +284,13 @@ class FPS_GT511C3
266284
// Generally, use high quality for enrollment, and low quality for verification/identification
267285
// Returns: True if ok, false if no finger pressed
268286
bool CaptureFinger(bool highquality);
287+
#ifndef __GNUC__
269288
#pragma endregion
289+
#endif //__GNUC__
270290

291+
#ifndef __GNUC__
271292
#pragma region -= Not implemented commands =-
293+
#endif //__GNUC__
272294
// Gets an image that is 258x202 (52116 bytes) and returns it in 407 Data_Packets
273295
// Use StartDataDownload, and then GetNextDataPacket until done
274296
// Returns: True (device confirming download starting)
@@ -319,9 +341,13 @@ class FPS_GT511C3
319341
// UpgradeISOCDImage - Data Sheet says not supported
320342
// SetIAPMode - for upgrading firmware (which is not supported)
321343
// Ack and Nack are listed as a commands for some unknown reason... not implemented
322-
#pragma endregion
344+
#ifndef __GNUC__
345+
#pragma endregion
346+
#endif //__GNUC__
323347

348+
#ifndef __GNUC__
324349
#pragma endregion
350+
#endif //__GNUC__
325351

326352
void serialPrintHex(byte data);
327353
void SendToSerial(byte data[], int length);

0 commit comments

Comments
 (0)