@@ -37,12 +37,12 @@ void FingerprintModule::setup()
3737 attachInterrupt (digitalPinToInterrupt (TOUCH_RIGHT_PIN ), FingerprintModule::interruptTouchRight, CHANGE );
3838
3939 logInfoP (" Fingerprint start" );
40- bool success = finger. start ();
40+ bool success = finger-> start ();
4141 KoFIN_ScannerStatus.value (success, DPT_Switch);
4242
4343 digitalWrite (LED_RED_PIN , LOW );
4444 digitalWrite (LED_GREEN_PIN , HIGH );
45- finger. setLed (Fingerprint::State::Success);
45+ finger-> setLed (Fingerprint::State::Success);
4646
4747 KoFIN_LedRingColor.valueNoSend ((uint8_t )0 , Dpt (5 , 10 ));
4848 KoFIN_LedRingControl.valueNoSend ((uint8_t )FINGERPRINT_LED_OFF , Dpt (5 , 10 ));
@@ -59,7 +59,7 @@ void FingerprintModule::initFingerprintScanner()
5959{
6060 uint32_t scannerPassword = _fingerprintStorage.readInt (FLASH_SCANNER_PASSWORD_OFFSET );
6161 logDebugP (" Initialize scanner with password: %u" , scannerPassword);
62- finger = Fingerprint (delayCallback, scannerPassword);
62+ finger = new Fingerprint (FingerprintModule:: delayCallback, scannerPassword);
6363}
6464
6565void FingerprintModule::initFlash ()
@@ -131,7 +131,7 @@ void FingerprintModule::loop()
131131 else
132132 {
133133 if (KoFIN_Touched.value (DPT_Switch) &&
134- !finger. hasFinger ())
134+ !finger-> hasFinger ())
135135 KoFIN_Touched.value (false , DPT_Switch);
136136 }
137137 }
@@ -157,7 +157,7 @@ void FingerprintModule::loop()
157157 if (checkSensorTimer > 0 && delayCheck (checkSensorTimer, CHECK_SENSOR_DELAY ))
158158 {
159159 bool currentStatus = KoFIN_ScannerStatus.value (DPT_Switch);
160- bool success = finger. checkSensor ();
160+ bool success = finger-> checkSensor ();
161161 if (currentStatus != success)
162162 KoFIN_ScannerStatus.value (success, DPT_Switch);
163163
@@ -166,7 +166,7 @@ void FingerprintModule::loop()
166166
167167 if (initResetTimer > 0 && delayCheck (initResetTimer, INIT_RESET_TIMEOUT ))
168168 {
169- finger. setLed (Fingerprint::State::None);
169+ finger-> setLed (Fingerprint::State::None);
170170 digitalWrite (LED_GREEN_PIN , LOW );
171171 initResetTimer = 0 ;
172172 }
@@ -194,7 +194,7 @@ void FingerprintModule::loop()
194194
195195bool FingerprintModule::searchForFinger ()
196196{
197- if (!finger. hasFinger ())
197+ if (!finger-> hasFinger ())
198198 {
199199 if (ParamFIN_ScanMode == 1 &&
200200 KoFIN_Touched.value (DPT_Switch))
@@ -208,7 +208,7 @@ bool FingerprintModule::searchForFinger()
208208 !KoFIN_Touched.value (DPT_Switch))
209209 KoFIN_Touched.value (true , DPT_Switch);
210210
211- Fingerprint::FindFingerResult findFingerResult = finger. findFingerprint ();
211+ Fingerprint::FindFingerResult findFingerResult = finger-> findFingerprint ();
212212
213213 if (findFingerResult.found )
214214 {
@@ -229,7 +229,7 @@ bool FingerprintModule::searchForFinger()
229229 else
230230 {
231231 hasLastFoundLocation = false ;
232- finger. setLed (Fingerprint::ScanNoMatch);
232+ finger-> setLed (Fingerprint::ScanNoMatch);
233233
234234 logInfoP (" Finger not found" );
235235 KoFIN_ScanSuccess.value (false , DPT_Switch);
@@ -252,7 +252,7 @@ bool FingerprintModule::searchForFinger()
252252
253253void FingerprintModule::resetRingLed ()
254254{
255- finger. setLed (KoFIN_LedRingColor.value (Dpt (5 , 10 )), KoFIN_LedRingControl.value (Dpt (5 , 10 )), KoFIN_LedRingSpeed.value (Dpt (5 , 10 )), KoFIN_LedRingCount.value (Dpt (5 , 10 )));
255+ finger-> setLed (KoFIN_LedRingColor.value (Dpt (5 , 10 )), KoFIN_LedRingControl.value (Dpt (5 , 10 )), KoFIN_LedRingSpeed.value (Dpt (5 , 10 )), KoFIN_LedRingCount.value (Dpt (5 , 10 )));
256256 logInfoP (" LED ring: color=%u, control=%u, speed=%u, count=%u" , (uint8_t )KoFIN_LedRingColor.value (Dpt (5 , 10 )), (uint8_t )KoFIN_LedRingControl.value (Dpt (5 , 10 )), (uint8_t )KoFIN_LedRingSpeed.value (Dpt (5 , 10 )), (uint8_t )KoFIN_LedRingCount.value (Dpt (5 , 10 )));
257257}
258258
@@ -285,12 +285,12 @@ void FingerprintModule::processScanSuccess(uint16_t location, bool external)
285285 if (actionExecuted)
286286 {
287287 if (!external)
288- finger. setLed (Fingerprint::ScanMatch);
288+ finger-> setLed (Fingerprint::ScanMatch);
289289 }
290290 else
291291 {
292292 if (!external)
293- finger. setLed (Fingerprint::ScanMatchNoAction);
293+ finger-> setLed (Fingerprint::ScanMatchNoAction);
294294
295295 KoFIN_TouchedNoAction.value (true , DPT_Switch);
296296 }
@@ -301,10 +301,10 @@ bool FingerprintModule::enrollFinger(uint16_t location)
301301 logInfoP (" Enroll request:" );
302302 logIndentUp ();
303303
304- bool success = finger. createTemplate ();
304+ bool success = finger-> createTemplate ();
305305 if (success)
306306 {
307- success = finger. storeTemplate (location);
307+ success = finger-> storeTemplate (location);
308308 if (!success)
309309 {
310310 logInfoP (" Storing template failed." );
@@ -328,7 +328,7 @@ bool FingerprintModule::enrollFinger(uint16_t location)
328328 KoFIN_EnrollSuccess.valueNoSend (false , Dpt (15 , 1 , 4 )); // encryption (not used for now)
329329 KoFIN_EnrollSuccess.value ((uint8_t )0 , Dpt (15 , 1 , 5 )); // index of access identification code (not used)
330330
331- finger. setLed (Fingerprint::State::Success);
331+ finger-> setLed (Fingerprint::State::Success);
332332 }
333333 else
334334 {
@@ -343,7 +343,7 @@ bool FingerprintModule::enrollFinger(uint16_t location)
343343 KoFIN_EnrollSuccessData.valueNoSend (false , Dpt (15 , 1 , 4 )); // encryption (not used for now)
344344 KoFIN_EnrollSuccessData.value ((uint8_t )0 , Dpt (15 , 1 , 5 )); // index of access identification code (not used)
345345
346- finger. setLed (Fingerprint::State::Failed);
346+ finger-> setLed (Fingerprint::State::Failed);
347347 }
348348
349349 logIndentDown ();
@@ -357,7 +357,7 @@ bool FingerprintModule::deleteFinger(uint16_t location, bool sync)
357357 logInfoP (" Delete request:" );
358358 logIndentUp ();
359359
360- bool success = finger. deleteTemplate (location);
360+ bool success = finger-> deleteTemplate (location);
361361 if (success)
362362 {
363363 logInfoP (" Template deleted from location %d." , location);
@@ -460,7 +460,7 @@ void FingerprintModule::processInputKoLock(GroupObject &ko)
460460 logInfoP (" Locked: %d" , isLocked);
461461
462462 if (isLocked)
463- finger. setLed (Fingerprint::State::Locked);
463+ finger-> setLed (Fingerprint::State::Locked);
464464 else
465465 resetRingLed ();
466466}
@@ -481,7 +481,7 @@ void FingerprintModule::processInputKoEnroll(GroupObject &ko)
481481 uint16_t asap = ko.asap ();
482482 if (asap == FIN_KoEnrollNext)
483483 {
484- location = finger. getNextFreeLocation ();
484+ location = finger-> getNextFreeLocation ();
485485 logInfoP (" Next availabe location: %d" , location);
486486 }
487487 else if (asap == FIN_KoEnrollId)
@@ -534,12 +534,12 @@ void FingerprintModule::startSyncSend(uint16_t fingerId, bool loadModel)
534534
535535 logInfoP (" Sync-Send: started: fingerId=%u, loadModel=%u, syncDelay=%u" , fingerId, loadModel, ParamFIN_SyncDelay);
536536
537- finger. setLed (Fingerprint::State::Busy);
537+ finger-> setLed (Fingerprint::State::Busy);
538538
539539 bool success;
540540 if (loadModel)
541541 {
542- success = finger. loadTemplate (fingerId);
542+ success = finger-> loadTemplate (fingerId);
543543 if (!success)
544544 {
545545 logErrorP (" Sync-Send: loading template failed" );
@@ -548,7 +548,7 @@ void FingerprintModule::startSyncSend(uint16_t fingerId, bool loadModel)
548548 }
549549
550550 uint8_t syncSendBufferTemp[SYNC_BUFFER_SIZE ];
551- success = finger. retrieveTemplate (syncSendBufferTemp);
551+ success = finger-> retrieveTemplate (syncSendBufferTemp);
552552 if (!success)
553553 {
554554 logErrorP (" Sync-Send: retrieving template failed" );
@@ -713,15 +713,15 @@ void FingerprintModule::processSyncReceive(uint8_t* data)
713713
714714 if (syncReceivePacketReceivedCount == syncReceivePacketCount)
715715 {
716- finger. setLed (Fingerprint::State::Busy);
716+ finger-> setLed (Fingerprint::State::Busy);
717717
718718 uint16_t checksum = crc16 (syncReceiveBuffer, syncReceiveBufferLength);
719719 if (syncReceiveBufferChecksum == checksum)
720720 logDebugP (" Sync-Receive: finished (checksum=%u)" , syncReceiveBufferChecksum);
721721 else
722722 {
723723 logErrorP (" Sync-Receive: finished failed (checksum expected=%u, calculated=%u)" , syncReceiveBufferChecksum, checksum);
724- finger. setLed (Fingerprint::State::Failed);
724+ finger-> setLed (Fingerprint::State::Failed);
725725 resetLedsTimer = delayTimerInit ();
726726 return ;
727727 }
@@ -731,26 +731,26 @@ void FingerprintModule::processSyncReceive(uint8_t* data)
731731 if (decompressedSize != SYNC_BUFFER_SIZE )
732732 {
733733 logErrorP (" Sync-Receive: decompression failed (size expected=%u, received=%u)" , SYNC_BUFFER_SIZE , decompressedSize);
734- finger. setLed (Fingerprint::State::Failed);
734+ finger-> setLed (Fingerprint::State::Failed);
735735 resetLedsTimer = delayTimerInit ();
736736 return ;
737737 }
738738
739739 bool success;
740- success = finger. sendTemplate (syncSendBufferTemp);
740+ success = finger-> sendTemplate (syncSendBufferTemp);
741741 if (!success)
742742 {
743743 logErrorP (" Sync-Receive: sending template failed" );
744- finger. setLed (Fingerprint::State::Failed);
744+ finger-> setLed (Fingerprint::State::Failed);
745745 resetLedsTimer = delayTimerInit ();
746746 return ;
747747 }
748748
749- success = finger. storeTemplate (syncReceiveFingerId);
749+ success = finger-> storeTemplate (syncReceiveFingerId);
750750 if (!success)
751751 {
752752 logErrorP (" Sync-Receive: storing template failed" );
753- finger. setLed (Fingerprint::State::Failed);
753+ finger-> setLed (Fingerprint::State::Failed);
754754 resetLedsTimer = delayTimerInit ();
755755 return ;
756756 }
@@ -759,7 +759,7 @@ void FingerprintModule::processSyncReceive(uint8_t* data)
759759 _fingerprintStorage.write (storageOffset, syncSendBufferTemp + TEMPLATE_SIZE , 29 );
760760 _fingerprintStorage.commit ();
761761
762- finger. setLed (Fingerprint::State::Success);
762+ finger-> setLed (Fingerprint::State::Success);
763763 resetLedsTimer = delayTimerInit ();
764764 syncReceiving = false ;
765765 }
@@ -843,7 +843,7 @@ void FingerprintModule::handleFunctionPropertySyncFinger(uint8_t *data, uint8_t
843843 uint16_t fingerId = (data[1 ] << 8 ) | data[2 ];
844844 logDebugP (" fingerId: %d" , fingerId);
845845
846- if (finger. hasLocation (fingerId))
846+ if (finger-> hasLocation (fingerId))
847847 {
848848 syncRequestedFingerId = fingerId;
849849 syncRequestedTimer = delayTimerInit ();
@@ -887,7 +887,7 @@ void FingerprintModule::handleFunctionPropertyChangeFinger(uint8_t *data, uint8_
887887 uint16_t fingerId = (data[1 ] << 8 ) | data[2 ];
888888 logDebugP (" fingerId: %d" , fingerId);
889889
890- if (finger. hasLocation (fingerId))
890+ if (finger-> hasLocation (fingerId))
891891 {
892892 uint8_t personFinger = data[3 ];
893893 logDebugP (" personFinger: %d" , personFinger);
@@ -935,7 +935,7 @@ void FingerprintModule::handleFunctionPropertyResetScanner(uint8_t *data, uint8_
935935 }
936936 _fingerprintStorage.commit ();
937937
938- bool success = finger. emptyDatabase ();
938+ bool success = finger-> emptyDatabase ();
939939 resetLedsTimer = delayTimerInit ();
940940
941941 resultData[0 ] = success ? 0 : 1 ;
@@ -1000,7 +1000,7 @@ void FingerprintModule::handleFunctionPropertySetPassword(uint8_t *data, uint8_t
10001000
10011001 logInfoP (" Setting new fingerprint scanner password." );
10021002 logIndentUp ();
1003- success = finger. setPassword (newPasswordCrc);
1003+ success = finger-> setPassword (newPasswordCrc);
10041004 resetLedsTimer = delayTimerInit ();
10051005 logInfoP (success ? " Success." : " Failed." );
10061006 logIndentDown ();
@@ -1011,9 +1011,9 @@ void FingerprintModule::handleFunctionPropertySetPassword(uint8_t *data, uint8_t
10111011 _fingerprintStorage.writeInt (FLASH_SCANNER_PASSWORD_OFFSET , newPasswordCrc);
10121012 _fingerprintStorage.commit ();
10131013
1014- finger. close ();
1014+ finger-> close ();
10151015 initFingerprintScanner ();
1016- finger. start ();
1016+ finger-> start ();
10171017 }
10181018
10191019 resetLedsTimer = delayTimerInit ();
@@ -1039,7 +1039,7 @@ void FingerprintModule::handleFunctionPropertySearchPersonByFingerId(uint8_t *da
10391039 uint16_t fingerId = (data[1 ] << 8 ) | data[2 ];
10401040 logDebugP (" fingerId: %d" , fingerId);
10411041
1042- if (!finger. hasLocation (fingerId))
1042+ if (!finger-> hasLocation (fingerId))
10431043 {
10441044 logDebugP (" Unrecognized by scanner!" );
10451045 resultData[0 ] = 1 ;
@@ -1109,8 +1109,8 @@ void FingerprintModule::handleFunctionPropertySearchFingerIdByPerson(uint8_t *da
11091109 logDebugP (" searchPersonName: %s (length: %u)" , searchPersonName, searchPersonNameLength);
11101110 logDebugP (" resultLength: %u" , resultLength);
11111111
1112- uint16_t * fingerIds = finger. getLocations ();
1113- uint16_t templateCount = finger. getTemplateCount ();
1112+ uint16_t * fingerIds = finger-> getLocations ();
1113+ uint16_t templateCount = finger-> getTemplateCount ();
11141114
11151115 uint32_t storageOffset = 0 ;
11161116 uint8_t personFinger = 0 ;
0 commit comments