Skip to content

Commit 1b850c4

Browse files
committed
add SERIAL_NUMBER_ADDRESS exist checking
1 parent 187d8cb commit 1b850c4

3 files changed

Lines changed: 17 additions & 11 deletions

File tree

HISTORY.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
## [1.5.4] - 2016-05-02
2+
3+
### Fix
4+
5+
- if SERIAL_NUMBER_ADDRESS equal SERIAL_NUMBER_ADDRESS, then Serial Number exist in EEPROM
6+
17
## [1.5.3] - 2016-05-02
28

39
### Changes
410

5-
- Add readSerialNumber & writeSerialNumber function
11+
- Add readSerialNumber & writeSerialNumber function (Serial Number: Address 1024, size:14)
612

713

814
## [1.5.2] - 2016-04-29

uarm_library.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
* Author : Joey Song
44
* Updated : Joey Song, Alex Tan, Dave Corboy
55
* Email : joey@ufactory.cc
6-
* Version : V1.5.2
7-
* Date : 12 Dec, 2014
8-
* Modified Date : 18 Apr, 2016
96
* Description :
107
* License :
118
* Copyright(C) 2016 UFactory Team. All right reserved.
@@ -24,18 +21,21 @@ uArmClass::uArmClass()
2421
* SERIAL NUMBER ADDRESS : 1024, Size: 14
2522
*/
2623
void uArmClass::readSerialNumber(byte (&byte_sn_array)[14]){
27-
for(byte i=0; i<14; i++){
28-
byte_sn_array[i] = EEPROM.read(SERIAL_NUMBER_ADDRESS+i);
29-
}
24+
if (EEPROM.read(SERIAL_NUMBER_ADDRESS) == SERIAL_NUMBER_ADDRESS){
25+
for(byte i=0; i<14; i++){
26+
byte_sn_array[i] = EEPROM.read(SERIAL_NUMBER_ADDRESS+i+1);
27+
}
28+
}
3029
}
3130

3231
/* Write Serial Number to EEPROM
3332
* SERIAL NUMBER ADDRESS : 1024, Size: 14
3433
*/
3534
void uArmClass::writeSerialNumber(byte (&byte_sn_array)[14]){
36-
for(byte i=0; i<14; i++){
37-
EEPROM.write(SERIAL_NUMBER_ADDRESS+i, byte_sn_array[i]);
38-
}
35+
for(byte i=0; i<14; i++){
36+
EEPROM.write(SERIAL_NUMBER_ADDRESS+i+1, byte_sn_array[i]);
37+
}
38+
EEPROM.write(SERIAL_NUMBER_ADDRESS, SERIAL_NUMBER_ADDRESS);
3939
}
4040

4141
/* Use BUZZER for Alert

uarm_library.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#define UARM_MAJOR_VERSION 1
2424
#define UARM_MINOR_VERSION 5
25-
#define UARM_BUGFIX 3
25+
#define UARM_BUGFIX 4
2626

2727
#define SERVO_ROT_NUM 0
2828
#define SERVO_LEFT_NUM 1

0 commit comments

Comments
 (0)