Skip to content

Commit d7e5581

Browse files
committed
Merge branch 'master' of https://github.com/kollokollo/ArduinoFloppyDiskReader into kollokollo-master
2 parents 4d6e57d + d4d385e commit d7e5581

File tree

6 files changed

+573
-30
lines changed

6 files changed

+573
-30
lines changed

ArduinoFloppyReader/lib/ArduinoInterface.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ using namespace ArduinoFloppyReader;
4646
#define COMMAND_ENABLEWRITE '~'
4747
#define COMMAND_ERASETRACK 'X'
4848
#define COMMAND_DIAGNOSTICS '&'
49-
49+
#define COMMAND_SWITCHTO_DD 'D'
50+
#define COMMAND_SWITCHTO_HD 'H'
51+
#define COMMAND_DETECT_DISK_TYPE 'M' // currently not implemented here
5052

5153
// Convert the last executed command that had an error to a string
5254
std::string lastCommandToName(LastCommand cmd) {
@@ -63,6 +65,7 @@ std::string lastCommandToName(LastCommand cmd) {
6365
case LastCommand::lcWriteTrack: return "WriteTrack";
6466
case LastCommand::lcRunDiagnostics: return "RunDiagnostics";
6567
case LastCommand::lcEraseTrack: return "EraseTrack";
68+
case LastCommand::lcSwitchDiskMode: return "SetCapacity";
6669
default: return "Unknown";
6770
}
6871
}
@@ -438,6 +441,18 @@ DiagnosticResponse ArduinoInterface::enableReading(const bool enable, const bool
438441
}
439442
}
440443

444+
// Check and switch to HD disk
445+
DiagnosticResponse ArduinoInterface::setDiskCapacity(bool switchToHD_Disk) {
446+
// Disable the device
447+
m_lastError = runCommand(switchToHD_Disk ? COMMAND_SWITCHTO_HD : COMMAND_SWITCHTO_DD);
448+
if (m_lastError != DiagnosticResponse::drOK) {
449+
m_lastCommand = LastCommand::lcSwitchDiskMode;
450+
return m_lastError;
451+
}
452+
453+
return m_lastError;
454+
}
455+
441456
// Select the track, this makes the motor seek to this position
442457
DiagnosticResponse ArduinoInterface::selectTrack(const unsigned char trackIndex) {
443458
if (trackIndex > 81) {

ArduinoFloppyReader/lib/ArduinoInterface.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ namespace ArduinoFloppyReader {
108108
lcReadTrack,
109109
lcWriteTrack,
110110
lcEraseTrack,
111-
lcRunDiagnostics
111+
lcRunDiagnostics,
112+
lcSwitchDiskMode
112113
};
113114

114115
class ArduinoInterface {
@@ -165,6 +166,9 @@ namespace ArduinoFloppyReader {
165166
// Check CTS status by asking the device to set it and then checking what happened
166167
DiagnosticResponse testDataPulse();
167168

169+
// Check and switch to HD disk
170+
DiagnosticResponse setDiskCapacity(bool switchToHD_Disk);
171+
168172
// Select the track, this makes the motor seek to this position
169173
DiagnosticResponse selectTrack(const unsigned char trackIndex);
170174

CONTRIBUTING.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
Guide to contributing to the Arduino Floppy Disk Controller
2+
===========================================================
3+
This document was provided by kollokollo
4+
5+
The Arduino firmware is already very useful und can read everything.
6+
The track is always read at-once, because the sector-wise reading depends
7+
on the format (AMIGA, PC, ATARI, COMMODORE etc..). Letting the format be
8+
detected by PC software is part of the concept, and sufficiently smart,
9+
so this need not be changed. To read a single sector, the PC software can
10+
instruct the Arduino formware to read the whole track, and then it can
11+
decode only a single sector. There are options to wait or not wait for the
12+
index pulse when reading, so that even a fast reading should be possible.
13+
14+
Improvements can be done with writing to the disk. Here contributions are
15+
welcome.
16+
17+
However writing is olnly supported for DD track-at once currently. Since the
18+
Arduino cannot buffer the data for a whole track, the writing need do be
19+
in sync with data arriving via the serial interface. This is a bit tricky
20+
and does not always work. Writing a track at once is the normal way to either
21+
* format the disk (ATARI ST, PC) or
22+
* write data to it (AMIGA).
23+
Writing individual Sectors should maybe made possible in furture (and a single
24+
sector data can well be buffered by the firmware). But sector detection is
25+
format dependant. Luckily for the ATARI ST and PC disks the sector marks
26+
are the same. COMMODORE disks will maybe later be supported.
27+
28+
29+
Other ideas:
30+
* How about a block device driver for linux (interfacinge the Arduino firmware)?
31+
32+
## License and attribution
33+
34+
All contributions must be properly licensed and attributed. If you are contributing your own original work, then you are offering it under a CC-BY license (Creative Commons Attribution). If it is code, you are offering it under the GPL-v2. You are responsible for adding your own name or pseudonym in the Acknowledgments file, as attribution for your contribution.
35+
36+
If you are sourcing a contribution from somewhere else, it must carry a compatible license. The project was initially released under the GNU public licence GPL-v2 which means that contributions must be licensed under open licenses such as MIT, CC0, CC-BY, etc. You need to indicate the original source and original license, by including a comment above your contribution.
37+
38+
## Contributing with a Pull Request
39+
40+
The best way to contribute to this project is by making a pull request:
41+
42+
1. Login with your Github account or create one now
43+
2. [Fork](https://github.com/kollokollo/ArduinoFloppyDiskReader#fork-destination-box) the ArduinoFloppyDiskReader repository. Work on your fork.
44+
3. Create a new branch on which to make your change, e.g.
45+
`git checkout -b my_code_contribution`, or make the change on the `new` branch.
46+
4. Edit the file where you want to make a change or create a new file in the `contrib` directory if you're not sure where your contribution might fit.
47+
5. Edit `ACKNOWLEGEMENTS` and add your own name to the list of contributors under the section with the current year. Use your name, or a github ID, or a pseudonym.
48+
6. Commit your change. Include a commit message describing the correction.
49+
7. Submit a pull request against the ArduinoFloppyDiskReader repository.
50+
51+
52+
## Contributing with an Issue
53+
54+
If you find a mistake and you're not sure how to fix it, or you don't know how to do a pull request, then you can file an Issue. Filing an Issue will help us see the problem and fix it.
55+
56+
Create a [new Issue](https://github.com/kollokollo/ArduinoFloppyDiskReader/issues/new) now!
57+
58+
59+
## Thanks
60+
61+
We are very grateful for your support. With your help, this implementation will be a great project.

0 commit comments

Comments
 (0)