Skip to content
Browse files

Fixes

Signed-off-by: Eric Holmes <eric@ejholmes.net>
  • Loading branch information...
1 parent 9abb054 commit e8062ac425d3143368dca08dbd19388db7e88366 @ejholmes committed
Showing with 19 additions and 5 deletions.
  1. +12 −2 bootloader.cpp
  2. +4 −0 device.cpp
  3. +3 −3 openfocus.h
View
14 bootloader.cpp
@@ -21,12 +21,14 @@
const unsigned short OpenFocus::Bootloader::Vendor_ID = BOOTLOADER_VID;
const unsigned short OpenFocus::Bootloader::Product_ID = BOOTLOADER_PID;
+unsigned short OpenFocus::Bootloader::PageSize = 0;
+unsigned short OpenFocus::Bootloader::FlashSize = 0;
+unsigned short OpenFocus::Bootloader::EEPROMSize = 0;
+
dev_handle *OpenFocus::Bootloader::device = NULL;
OpenFocus::Bootloader::Bootloader()
{
- if (device)
- GetReport();
}
bool OpenFocus::Bootloader::Connect()
@@ -34,6 +36,9 @@ bool OpenFocus::Bootloader::Connect()
if (!usb_open_device(&device, Vendor_ID, Product_ID, NULL))
return false;
+ if (device)
+ GetReport();
+
return true;
}
@@ -73,6 +78,11 @@ int OpenFocus::Bootloader::GetReport()
FlashSize = report.flashsize;
EEPROMSize = report.eepromsize;
+ DBG("Device Information:\n");
+ DBG("\tPage Size: %d\n", PageSize);
+ DBG("\tFlash Size: %d\n", FlashSize);
+ DBG("\tEEPROM Size: %d\n", EEPROMSize);
+
return retval;
}
View
4 device.cpp
@@ -178,6 +178,10 @@ int OpenFocus::Device::GetCapabilities()
CanAbsolutePosition = ((capabilities & CAP_ABSOLUTE_POSITIONING) == CAP_ABSOLUTE_POSITIONING);
CanTemperatureCompensate = ((capabilities & CAP_TEMPERATURE_COMPENSATION) == CAP_TEMPERATURE_COMPENSATION);
+ DBG("Capabilities:\n");
+ DBG("\tAbsolute Positioning: %s\n", CanAbsolutePosition ? "yes" : "no");
+ DBG("\tTemperature Compensation: %s\n", CanTemperatureCompensate ? "yes" : "no");
+
return retval;
}
View
6 openfocus.h
@@ -183,11 +183,11 @@ namespace OpenFocus
/* Page size of device */
- unsigned short PageSize;
+ static unsigned short PageSize;
/* Flash size of device */
- unsigned short FlashSize;
+ static unsigned short FlashSize;
/* EEPROM size */
- unsigned short EEPROMSize;
+ static unsigned short EEPROMSize;
};
class Helper

0 comments on commit e8062ac

Please sign in to comment.
Something went wrong with that request. Please try again.