void FTDIDMXDevice::run() { // Write the data to the device ULONG bytesWritten; unsigned char startCode = 0; // Wait for device to clear usleep(1000); while (m_threadRunning == true) { // usleep values added by suggestion of Hugh Blemings // on qlc-devel mailing list (11/02/09). // As I have not run more than one dimmer rack with this // plugin I am unable to assertain whether or not this // is better or equivilent to previous code therefore // I am including it in order for the analysis of the users. // At the time of writing LLA is being re-vamped so this // plugin will become redundant for all but Windows users. // Write data FT_SetBreakOn(m_handle); usleep(88); FT_SetBreakOff(m_handle); usleep(8); FT_Write(m_handle, &startCode, 1, &bytesWritten); FT_Write(m_handle, m_values, 512, &bytesWritten); usleep(24000); } }
FT_STATUS ftdimut_init() { FT_STATUS ftStatus; unsigned char buf[4]; unsigned int bytesRead = 0; if(ftdimut_getData(0x17) != 0) { return FT_OK; } printf("Sending 0x00 at 5 baud\n"); printf("Break on......\n"); ftStatus = FT_SetBreakOn(ftHandle); if(ftStatus != FT_OK) return ftStatus; usleep(1800 * 1000); printf("Break off......\n"); ftStatus = FT_SetBreakOff(ftHandle); if(ftStatus != FT_OK) return ftStatus; ftStatus = FT_Read(ftHandle, buf, 4, &bytesRead); if(ftStatus != FT_OK) return ftStatus; if(bytesRead == 4) { return FT_OK; } return FT_OTHER_ERROR; }