Example #1
0
bool UP3D_SetPrintJobInfo( uint8_t progID, uint8_t x, uint32_t y )
{
  if( progID>9 )
    return false;

  uint8_t UP3D_CMD_63_X_Y[7] = { 0x63, progID, x, (y>>0)&0xFF, (y>>8)&0xFF, (y>>16)&0xFF, (y>>24)&0xFF };
  uint8_t resp[2048];

  if( (UP3DCOMM_Write( UP3D_CMD_63_X_Y, sizeof(UP3D_CMD_63_X_Y) ) != sizeof(UP3D_CMD_63_X_Y)) ||
      (1 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[0]) )
    return false;

  return true;
}

bool UP3D_InsertRomProgram( uint8_t prog )
{
  uint8_t UP3D_CMD_4C_X[] = { 0x4C, '0'+prog };
  uint8_t resp[2048];

  if( (UP3DCOMM_Write( UP3D_CMD_4C_X, sizeof(UP3D_CMD_4C_X) ) != sizeof(UP3D_CMD_4C_X)) ||
      (5 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[4]) ||
      (1 != resp[0])
    )
    return false;

  return true;
}
Example #2
0
bool UP3D_GetPrinterInfo(TT_tagPrinterInfoHeader *pihdr, TT_tagPrinterInfoName *piname, TT_tagPrinterInfoData *pidata, TT_tagPrinterInfoSet pisets[8])
{
  static const uint8_t UP3D_CMD_52[] = { 0x52, 0x00 }; //GetPrinterInfo
  uint8_t resp[2048];
  if( (UP3DCOMM_Write( UP3D_CMD_52, sizeof(UP3D_CMD_52) ) != sizeof(UP3D_CMD_52)) )
    return false;
  
  if( (1 != UP3DCOMM_Read( resp, 1 )) || (7 != resp[0]) )
    return false;


  if( (sizeof(TT_tagPrinterInfoHeader) != UP3DCOMM_Read( (uint8_t*)pihdr,  sizeof(TT_tagPrinterInfoHeader) )) ||
      (sizeof(TT_tagPrinterInfoName  ) != UP3DCOMM_Read( (uint8_t*)piname, sizeof(TT_tagPrinterInfoName) )) ||
      (sizeof(TT_tagPrinterInfoData)   != UP3DCOMM_Read( (uint8_t*)pidata, sizeof(TT_tagPrinterInfoData) ))
    )
    return false;

  if( pidata->u32_NumSets>8 )
    return false;

  uint32_t s;
  for( s=0; s<pidata->u32_NumSets; s++ )
  {
    if( (16 != UP3DCOMM_Read( (uint8_t*)(&pisets[s])+ 0, 16 )) ||
        (60 != UP3DCOMM_Read( (uint8_t*)(&pisets[s])+16, 60 )) ||
        (60 != UP3DCOMM_Read( (uint8_t*)(&pisets[s])+76, 60 ))
      )
      return false;
  }

  if( (1 != UP3DCOMM_Read( resp, 1 )) || (6 != resp[0]) )
    return false;

  return true;
}
Example #3
0
File: up3d.c Project: kscheff/UP3D
unsigned int UP3D_IsPrinterResponsive()
{
  static const uint8_t UP3D_CMD_1[] = { 0x01, 0x00 }; //GetFwVersion
  uint8_t resp[2048];
  if( (UP3DCOMM_Write( UP3D_CMD_1, sizeof(UP3D_CMD_1) ) != sizeof(UP3D_CMD_1)) ||
      (5 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[4]) )
    return false;
<<<<<<< HEAD:UP3DTOOLS/up3d.c
Example #4
0
bool UP3D_IsPrinterResponsive()
{
  static const uint8_t UP3D_CMD_1[] = { 0x01, 0x00 }; //GetFwVersion ?
  uint8_t resp[2048];  
  if( (UP3DCOMM_Write( UP3D_CMD_1, sizeof(UP3D_CMD_1) ) != sizeof(UP3D_CMD_1)) ||
      (5 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[4]) )
    return false;
    
  return true;
}
Example #5
0
bool UP3D_Execute()
{
  static const uint8_t UP3D_CMD_58[] = { 0x58 };
  uint8_t resp[2048];  

  if( (UP3DCOMM_Write( UP3D_CMD_58, sizeof(UP3D_CMD_58) ) != sizeof(UP3D_CMD_58)) ||
      (0 == UP3DCOMM_Read( resp, sizeof(resp) )) /*||
      (6 != resp[0])*/ )                                //returns "Exe Count: 0" 06
    return false;
  return true;
}
Example #6
0
bool UP3D_SendRandom()
{
  uint8_t UP3D_CMD_2B_RRR[9] = { 0x2B, 0xCA,0xFE,0x00,0x00,0x00,0x00,0x12,0x34 };
  uint8_t resp[2048];

  if( (UP3DCOMM_Write( UP3D_CMD_2B_RRR, sizeof(UP3D_CMD_2B_RRR) ) != sizeof(UP3D_CMD_2B_RRR)) ||
      (1 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[0]) )
    return false;
    
  return true;
}
Example #7
0
uint32_t UP3D_GetFreeBlocks()
{
  static const uint8_t UP3D_CMD_46[] = { 0x46 };
  uint8_t resp[2048];

  if( (UP3DCOMM_Write( UP3D_CMD_46, sizeof(UP3D_CMD_46) ) != sizeof(UP3D_CMD_46)) ||
      (5 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[4]) )
    return 0;

  return le32toh( *((uint32_t*)resp) );
}
Example #8
0
bool UP3D_ClearProgramBuf()
{
  static const uint8_t UP3D_CMD_43[] = { 0x43 };
  uint8_t resp[2048];

  if( (UP3DCOMM_Write( UP3D_CMD_43, sizeof(UP3D_CMD_43) ) != sizeof(UP3D_CMD_43)) ||
      (1 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[0]) )
    return false;

  return true;
}
Example #9
0
uint32_t UP3D_GetParameter(uint8_t param)
{
  uint8_t UP3D_CMD_76_X[] = { 0x76, param };
  uint8_t resp[2048];

  if( (UP3DCOMM_Write( UP3D_CMD_76_X, sizeof(UP3D_CMD_76_X) ) != sizeof(UP3D_CMD_76_X)) ||
      (5 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[4]) )
    return 0;

  return le32toh( *((uint32_t*)resp) );
}
Example #10
0
bool UP3D_BeginWrite()
{
  static const uint8_t UP3D_CMD_63[] = { 0x63 };
  uint8_t resp[2048];  

  if( (UP3DCOMM_Write( UP3D_CMD_63, sizeof(UP3D_CMD_63) ) != sizeof(UP3D_CMD_63)) ||
      (1 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[0]) )
    return false;

  return true;
}
Example #11
0
bool UP3D_SetParameter(uint8_t param, uint32_t value)
{
  uint8_t UP3D_CMD_56_X_Y[6] = { 0x56, param, 0x00,0x00,0x00,0x00 };
  memcpy( &UP3D_CMD_56_X_Y[2], &value, sizeof(value) );
  uint8_t resp[2048];

  if( (UP3DCOMM_Write( UP3D_CMD_56_X_Y, sizeof(UP3D_CMD_56_X_Y) ) != sizeof(UP3D_CMD_56_X_Y)) ||
      (1 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[0]) )
    return false;
    
  return true;
}
Example #12
0
bool UP3D_IsPrinterResponsive()
{
  static const uint8_t UP3D_CMD_1[] = { 0x01, 0x00 }; //GetFwVersion
  uint8_t resp[2048];
  if( (UP3DCOMM_Write( UP3D_CMD_1, sizeof(UP3D_CMD_1) ) != sizeof(UP3D_CMD_1)) ||
      (5 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[4]) )
    return false;

  _up3d_connected_fw_version = le32toh(*((uint32_t*)resp));

  return true;
}
Example #13
0
bool UP3D_GetSystemVar(uint8_t param, int32_t *var)
{
  uint8_t UP3D_CMD_76_X[] = { 0x76, param };
  uint8_t resp[2048];

  if( (UP3DCOMM_Write( UP3D_CMD_76_X, sizeof(UP3D_CMD_76_X) ) != sizeof(UP3D_CMD_76_X)) ||
      (5 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[4]) )
    return false;

  *var = le32toh( *((uint32_t*)resp) );
  return true;
}
Example #14
0
uint32_t UP3D_GetParameter(uint8_t param)
{
  uint8_t UP3D_CMD_76_X[] = { 0x76, param };
  uint8_t resp[2048];

  if( (UP3DCOMM_Write( UP3D_CMD_76_X, sizeof(UP3D_CMD_76_X) ) != sizeof(UP3D_CMD_76_X)) ||
      (5 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[4]) )
    return 0;

  uint32_t r;
  memcpy( &r, resp, sizeof(r) );
  return r;
}
Example #15
0
uint32_t UP3D_GetFreeBlocks()
{
  static const uint8_t UP3D_CMD_46[] = { 0x46 };
  uint8_t resp[2048];

  if( (UP3DCOMM_Write( UP3D_CMD_46, sizeof(UP3D_CMD_46) ) != sizeof(UP3D_CMD_46)) ||
      (5 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[4]) )
    return 0;

  uint32_t r;
  memcpy( &r, resp, sizeof(r) );
  return r;
}
Example #16
0
int32_t UP3D_GetAxisPosition(int axis)
{
  if( (axis<1) || (axis>4) )
    return -1;
  uint8_t UP3D_CMD_70_X[] = { 0x70, '0'+axis-1 };
  uint8_t resp[2048];

  if( (UP3DCOMM_Write( UP3D_CMD_70_X, sizeof(UP3D_CMD_70_X) ) != sizeof(UP3D_CMD_70_X)) ||
      (5 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[4]) )
    return 0;

  return le32toh( *((uint32_t*)resp) );
}
Example #17
0
bool UP3D_InsertRomProgram( uint8_t prog )
{
  uint8_t UP3D_CMD_4C_X[] = { 0x4C, '0'+prog };
  uint8_t resp[2048];  

  if( (UP3DCOMM_Write( UP3D_CMD_4C_X, sizeof(UP3D_CMD_4C_X) ) != sizeof(UP3D_CMD_4C_X)) ||
      (5 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[4]) ||
      (1 != resp[0])
    )
    return false;
    
  return true;
}
Example #18
0
bool UP3D_SetProgramID( uint8_t progID, bool enableWrite )
{
  if( progID>9 )
    return false;
    
  uint8_t UP3D_CMD_6C_X_Y[3] = { 0x6C, progID, enableWrite?0x01:0x00 };
  uint8_t resp[2048];  

  if( (UP3DCOMM_Write( UP3D_CMD_6C_X_Y, sizeof(UP3D_CMD_6C_X_Y) ) != sizeof(UP3D_CMD_6C_X_Y)) ||
      (1 != UP3DCOMM_Read( resp, sizeof(resp) )) ||
      (6 != resp[0]) )
    return false;

  return true;
}