Modified Verify function

It will only report individual addresses if there are errors
Gives totals after completion
Is faster (if there are no errors due to serial communication)
This commit is contained in:
Artemio Urbina authored and GitHub committed 2019-01-16 23:08:16 -06:00
1 parent c60112e86a
commit 08ab129263
1 file changed
+29 -12
+29 -12
View File
@@ -222,13 +222,13 @@ int xorf = xora ^ xorb;
return invertbit(xorf);
}
void readportanalog(char port)
float readportanalog(char port)
{
int value = analogRead(port);
float voltage = value * (5.0 / 1023.0);
Serial.print(voltage);
//Serial.print(voltage);
return(voltage);
}
void clk68k(int count)
@@ -307,22 +307,39 @@ void writesecret()
void dataverifydo()
{
int ok = 0, fail = 0;
verifysecret();
digitalWrite(RW, HIGH); digitalWrite(AD1, HIGH); // activate D0 INPUT
pinMode(D0, INPUT);
p("Verifying, please wait\r\n");
for (int c=0; c <= 8191; c++) {
p(" Addr: "); Serial.print(c);
p(" Read volts: "); readportanalog(D0);
cByte = pgm_read_byte_near(EncryptionKey + c);
p(" Config Parity: "); Serial.print(parity(cByte));
p(" Chip Parity: "); Serial.print(digitalRead(D0));
if (parity(cByte) != digitalRead(D0)) {p(" NO MATCH");}
p("\r\n");
float voltage = readportanalog(D0);
cByte = pgm_read_byte_near(EncryptionKey + c);
if (parity(cByte) != digitalRead(D0))
{
p(" Addr: "); Serial.print(c);
p(" Read volts: "); Serial.print(voltage);
p(" Config Parity: "); Serial.print(parity(cByte));
p(" Chip Parity: "); Serial.print(digitalRead(D0));
p(" NO MATCH\r\n");
fail++;
}
else
ok ++;
digitalWrite(AS, HIGH); digitalWrite(AS, LOW);
}
if(!fail)
{
p("\r\nVerify OK, Correct Bytes: "); Serial.print(ok);
p("\r\n");
}
else
{
p("\r\nVerify FAILED, Errors "); Serial.print(fail);
p("\r\n");
}
}
void datawritedo()
@@ -467,4 +484,4 @@ void loop()
}
}
}