Browse Source

Merge pull request #26 from FrankBoesing/patch-1

capacity: return 0 for wrong id
main
Paul Stoffregen 8 years ago
parent
commit
ba91be363c
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      SerialFlashChip.cpp

+ 4
- 0
SerialFlashChip.cpp View File

@@ -446,6 +446,10 @@ uint32_t SerialFlashChip::capacity(const uint8_t *id)
} else
if (id[2] >= 32 && id[2] <= 37) {
n = 1ul << (id[2] - 6);
} else
if ((id[0]==0 && id[1]==0 && id[2]==0) ||
(id[0]==255 && id[1]==255 && id[2]==255)) {
n = 0;
}
//Serial.printf("capacity %lu\n", n);
return n;

Loading…
Cancel
Save