Skip to content

Commit

Permalink
[#65] Support for Greaseweazle boards (Part 7: Improved read error re…
Browse files Browse the repository at this point in the history
…porting)
  • Loading branch information
tomas-nestorovic committed Oct 14, 2022
1 parent e8096b6 commit 78f7323
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
33 changes: 29 additions & 4 deletions Main/src/Greaseweazle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,35 @@
return err;
if (*packet!=req)
return ERROR_ASSERTION_FAILURE;
if (packet[1]!=0)
return ERROR_GEN_FAILURE;
// - Request successfully sent to the Device
return ERROR_SUCCESS;
switch (packet[1]){
case TResponse::OKAY:
return ERROR_SUCCESS; // Request successfully sent to the Device
case TResponse::BAD_COMMAND:
return ERROR_BAD_COMMAND;
case TResponse::NO_INDEX:
return ERROR_INDEX_ABSENT;
case TResponse::NO_TRK0:
return ERROR_UNRECOGNIZED_MEDIA;
case TResponse::FLUX_OVERFLOW:
case TResponse::FLUX_UNDERFLOW:
return ERROR_READ_FAULT;
case TResponse::WRPROT:
return ERROR_WRITE_PROTECT;
case TResponse::NO_UNIT:
case TResponse::NO_BUS:
return ERROR_INVALID_DRIVE;
case TResponse::BAD_UNIT:
return ERROR_INVALID_DRIVE_OBJECT;
case TResponse::BAD_PIN:
return ERROR_INVALID_PARAMETER;
case TResponse::BAD_CYLINDER:
return ERROR_FLOPPY_WRONG_CYLINDER;
case TResponse::OUT_OF_SRAM:
case TResponse::OUT_OF_FLASH:
return ERROR_NOT_ENOUGH_MEMORY;
default:
return ERROR_GEN_FAILURE;
}
}

bool CGreaseweazleV4::SetMotorOn(bool on) const{
Expand Down
17 changes: 17 additions & 0 deletions Main/src/Greaseweazle.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@
NO_CLICK_STEP =22
};

enum TResponse:BYTE{
OKAY =0,
BAD_COMMAND =1,
NO_INDEX =2,
NO_TRK0 =3,
FLUX_OVERFLOW =4,
FLUX_UNDERFLOW =5,
WRPROT =6,
NO_UNIT =7,
NO_BUS =8,
BAD_UNIT =9,
BAD_PIN =10,
BAD_CYLINDER =11,
OUT_OF_SRAM =12,
OUT_OF_FLASH =13
};

const enum TDriver{
UNSUPPORTED,
USBSER
Expand Down

0 comments on commit 78f7323

Please sign in to comment.