You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (!askQuestion(false, "Please insert a disk in the drive.\r\nUse a disk that you don't mind being erased.\nThis disk must contain data/formatted as an AmigaDOS disk")) {
517
+
if (!askQuestion(false, "Please insert a *write protected* disk in the drive.\r\nUse a disk that you don't mind being erased.\nThis disk must contain data/formatted as an AmigaDOS disk")) {
if (m_device.checkIfDiskIsWriteProtected(true) == DiagnosticResponse::drWriteProtected) break;
605
+
606
+
if (!askQuestion(false, "Inserted disk is not write protected. If it is, then check Arduino Pin A0. Please insert a write protected AmigaDOS disk in the drive")) {
607
+
messageOutput(true, "Diagnostics aborted");
608
+
returnfalse;
609
+
}
610
+
}
611
+
}
612
+
599
613
// Functions to test
600
614
messageOutput(false, "Enabling the drive (please listen and watch the drive)");
if (m_device.checkIfDiskIsWriteProtected(true) == DiagnosticResponse::drOK) break;
868
+
869
+
if (!askQuestion(false, "Inserted disk is write protected. If it isn't, then check Arduino Pin A0. Please insert a write *enabled* disk in the drive")) {
messageOutput(true, "Unable to detect written track. This could be for one of the following reasons:");
953
977
messageOutput(true, "1. Please check the following PINS on the Arduino: 3, A0, A1");
954
-
messageOutput(true, "2. Please check the Ardiono IDE config has not been modified from stock. This was tested using 1.8.4, compiler settings may affect performance");
978
+
messageOutput(true, "2. Please check the Arduino IDE config has not been modified from stock. This was tested using 1.8.4, compiler settings may affect performance");
955
979
messageOutput(true, "3. Check for poor connections, typically on a breadboard they may be intermittent which may pass the above results but still not work.");
956
980
messageOutput(true, "4. Check for an electrically noisy environment. It is possible that electronic noise (eg: from a cell phone) may cause errors reading and writing to the disk");
957
981
messageOutput(true, "5. Shorten the floppy disk cable to help reduce noise.");
958
-
messageOutput(true, "6. Ensure your power supply is strong enough to power the floppy drive. Don't rely on the USB port for the 5V for the floppy drive!");
982
+
messageOutput(true, "6. Ensure your power supply is strong enough to power the floppy drive. This drive may need too much power for the USB port");
959
983
messageOutput(true, "7. You can contact me for help, but some basic electronics diagnostics will help, checkout YouTube for guides.");
960
984
961
985
m_device.enableWriting(false);
962
986
returnfalse;
963
987
}
964
-
else {
965
-
messageOutput(false, "Hurray! Writing was successful. Your Arduino is ready for use! - Send us a photo!");
988
+
989
+
// Attempt to write, with verify
990
+
messageOutput(false, "Writing (Precomp) and Verifying Track 41 (Upper Side).");
991
+
writtenOK = false;
992
+
for (int a = 1; a <= 10; a++) {
993
+
994
+
r = m_device.eraseCurrentTrack();
995
+
if (r != DiagnosticResponse::drOK) {
996
+
messageOutput(true, m_device.getLastErrorStr());
997
+
returnfalse;
998
+
}
999
+
1000
+
r = m_device.writeCurrentTrackPrecomp((constunsignedchar*)(&disktrack), sizeof(disktrack), false, true);
// Have a look at any of the found sectors and see if any are valid and matched the phrase we wrote onto the disk
1015
+
for (const DecodedSector& sec : trk.validSectors) {
1016
+
// See if we can find the sequence in here somewhere
1017
+
std::string s;
1018
+
s.resize(SECTOR_BYTES);
1019
+
memcpy(&s[0], sec.data, SECTOR_BYTES);
1020
+
1021
+
if (s.find(TEST_BYTE_SEQUENCE) != std::string::npos) {
1022
+
// Excellent
1023
+
writtenOK = true;
1024
+
break;
1025
+
}
1026
+
}
1027
+
if (!writtenOK) {
1028
+
// See if we can find the sequence in one of the partial sectors
1029
+
for (int sector = 0; sector < NUM_SECTORS_PER_TRACK; sector++) {
1030
+
for (const DecodedSector& sec : trk.invalidSectors[sector]) {
1031
+
// See if we can find the sequence in here somewhere
1032
+
std::string s;
1033
+
s.resize(SECTOR_BYTES);
1034
+
memcpy(&s[0], sec.data, SECTOR_BYTES);
1035
+
1036
+
if (s.find(TEST_BYTE_SEQUENCE) != std::string::npos) {
1037
+
// Excellent
1038
+
writtenOK = true;
1039
+
break;
1040
+
}
1041
+
}
1042
+
if (writtenOK) break;
1043
+
}
1044
+
if (writtenOK) break;
1045
+
}
1046
+
if (writtenOK) break;
1047
+
}
1048
+
1049
+
// Final results
1050
+
if (!writtenOK) {
1051
+
messageOutput(true, "Unable to detect written track. This could be for one of the following reasons:");
1052
+
messageOutput(true, "1. Please check the following PINS on the Arduino: 3, A0, A1");
1053
+
messageOutput(true, "2. Please check the Arduino IDE config has not been modified from stock. This was tested using 1.8.4, compiler settings may affect performance");
1054
+
messageOutput(true, "3. Check for poor connections, typically on a breadboard they may be intermittent which may pass the above results but still not work.");
1055
+
messageOutput(true, "4. Check for an electrically noisy environment. It is possible that electronic noise (eg: from a cell phone) may cause errors reading and writing to the disk");
1056
+
messageOutput(true, "5. Shorten the floppy disk cable to help reduce electrical noise.");
1057
+
messageOutput(true, "6. Ensure your power supply is strong enough to power the floppy drive. This drive may need too much power for the USB port");
1058
+
messageOutput(true, "7. If you are using a USB hub, try connecting directly to the computer or a different USB port");
1059
+
messageOutput(true, "8. You can contact me for help, but some basic electronics diagnostics will help, checkout YouTube for guides.");
1060
+
966
1061
m_device.enableWriting(false);
967
-
returntrue;
1062
+
returnfalse;
968
1063
}
969
-
1064
+
1065
+
messageOutput(false, "Hurray! Writing was successful. Your Arduino is ready for use! - Send us a photo");
1066
+
messageOutput(false, "or join my Discord server at https://discord.gg/HctVgSFEXu");
1067
+
m_device.enableWriting(false);
1068
+
returntrue;
970
1069
}
971
1070
972
1071
// Get the current firmware version. Only valid if openPort is successful
0 commit comments