Adjust errors to be consistent

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
TheJackiMonster 2023-09-08 00:40:17 +02:00
parent 98e123d103
commit 358923e19b
No known key found for this signature in database
GPG Key ID: D850A5F772E880F9
1 changed files with 9 additions and 4 deletions

View File

@ -616,10 +616,15 @@ int device3_calibrate(device3_type* device, uint32_t iterations, bool gyro, bool
device3_error("No device"); device3_error("No device");
return -1; return -1;
} }
if (!device->handle) {
device3_error("No handle");
return -2;
}
if (MAX_PACKET_SIZE != sizeof(device3_packet_type)) { if (MAX_PACKET_SIZE != sizeof(device3_packet_type)) {
device3_error("Not proper size"); device3_error("Not proper size");
return -2; return -3;
} }
device3_packet_type packet; device3_packet_type packet;
@ -643,8 +648,8 @@ int device3_calibrate(device3_type* device, uint32_t iterations, bool gyro, bool
); );
if (transferred == -1) { if (transferred == -1) {
fprintf(stderr, "HID read error: device may be unplugged\n"); fprintf(stderr, "Device may be unplugged");
return -3; return -4;
} }
if (transferred == 0) { if (transferred == 0) {
@ -653,7 +658,7 @@ int device3_calibrate(device3_type* device, uint32_t iterations, bool gyro, bool
if (MAX_PACKET_SIZE != transferred) { if (MAX_PACKET_SIZE != transferred) {
device3_error("Not expected issue"); device3_error("Not expected issue");
return -4; return -5;
} }
if ((packet.signature[0] != 0x01) || (packet.signature[1] != 0x02)) { if ((packet.signature[0] != 0x01) || (packet.signature[1] != 0x02)) {