diff --git a/UP3DCOMMON/up3dcomm.c b/UP3DCOMMON/up3dcomm.c index 3cbf4c4..9ff2151 100644 --- a/UP3DCOMMON/up3dcomm.c +++ b/UP3DCOMMON/up3dcomm.c @@ -17,6 +17,7 @@ #define VID (0x4745) #define PID_MINI_A (0x0001) #define PID_MINI_M (0x2777) +#define PID_MINI_2 (0x2790) #define PID_PLUS (0x277d) #define PID_CETUS_S7 (0x277f) #define EP_OUT 1 @@ -40,7 +41,7 @@ bool UP3DCOMM_Open() int r; r = libusb_init( &_libusb_ctx ); - if( r < 0 ) + if( r < 0 ) { printf( "[ERROR] USB Init: %d\n", r ); return false; @@ -51,17 +52,20 @@ bool UP3DCOMM_Open() _libusb_dev_handle = libusb_open_device_with_vid_pid( _libusb_ctx, VID, PID_MINI_A ); if( !_libusb_dev_handle ) _libusb_dev_handle = libusb_open_device_with_vid_pid( _libusb_ctx, VID, PID_MINI_M ); - + if( !_libusb_dev_handle ) _libusb_dev_handle = libusb_open_device_with_vid_pid( _libusb_ctx, VID, PID_PLUS ); if( !_libusb_dev_handle ) _libusb_dev_handle = libusb_open_device_with_vid_pid( _libusb_ctx, VID, PID_CETUS_S7 ); - + if( !_libusb_dev_handle ) + _libusb_dev_handle = libusb_open_device_with_vid_pid( _libusb_ctx, VID, PID_MINI_2 ); + + if( !_libusb_dev_handle ) { - fprintf(stderr, "[ERROR] USB Open Device (%04X:%04X/%04X/%04X/%04X) not found\n", VID, PID_MINI_A, PID_MINI_M, PID_PLUS, PID_CETUS_S7 ); + fprintf(stderr, "[ERROR] USB Open Device (%04X:%04X/%04X/%04X/%04X/%04X) not found\n", VID, PID_MINI_A, PID_MINI_M, PID_PLUS, PID_CETUS_S7, PID_MINI_2 ); UP3DCOMM_Close(); return false; } @@ -69,7 +73,7 @@ bool UP3DCOMM_Open() if( 1 == libusb_kernel_driver_active( _libusb_dev_handle, 0 ) ) libusb_detach_kernel_driver( _libusb_dev_handle, 0 ); - if( libusb_claim_interface( _libusb_dev_handle, 0 ) < 0 ) + if( libusb_claim_interface( _libusb_dev_handle, 0 ) < 0 ) { fprintf(stderr,"[ERROR] USB Claim Interface\n"); UP3DCOMM_Close(); diff --git a/UP3DCOMMON/up3dconf.c b/UP3DCOMMON/up3dconf.c index f22df4d..087e1a0 100644 --- a/UP3DCOMMON/up3dconf.c +++ b/UP3DCOMMON/up3dconf.c @@ -1,7 +1,7 @@ /* up3dconf.c for UP3DTranscoder M. Stohn 2016 - + This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -20,7 +20,20 @@ settings_t settings; -settings_t settings_mini = { +settings_t settings_mini = { + .steps_per_mm = { 854.0, 854.0, 854.0 }, + .max_rate = { 200, 200, 50 }, + .acceleration = { 1500, 1500, 1500 }, + .junction_deviation = 0.1, + .x_axes = 1, .y_axes = 0, + .x_dir = 1, .y_dir = -1, .z_dir = -1, + .x_hspeed_hi = 50.0, .y_hspeed_hi = 50.0, .z_hspeed_hi = 50.0, .x_hofs_hi = 4.0, .y_hofs_hi = 4.0, .z_hofs_hi = 6.0, + .x_hspeed_lo = 10.0, .y_hspeed_lo = 10.0, .z_hspeed_lo = 3.0, .x_hofs_lo = 9.0, .y_hofs_lo = 2.0, .z_hofs_lo = 2.0, + .heatbed_wait_factor = 20.0, +}; + +// experimental settings for the Mini 2 +settings_t settings_mini2 = { .steps_per_mm = { 854.0, 854.0, 854.0 }, .max_rate = { 200, 200, 50 }, .acceleration = { 1500, 1500, 1500 }, @@ -32,7 +45,7 @@ settings_t settings_mini = { .heatbed_wait_factor = 20.0, }; -settings_t settings_classic_plus = { +settings_t settings_classic_plus = { .steps_per_mm = { 644.0, 644.0, 854.0 }, .max_rate = { 200, 200, 50 }, .acceleration = { 1500, 1500, 1500 }, @@ -44,7 +57,7 @@ settings_t settings_classic_plus = { .heatbed_wait_factor = 30.0, }; -settings_t settings_box = { +settings_t settings_box = { .steps_per_mm = { 644.0, 644.0, 854.0 }, .max_rate = { 200, 200, 50 }, .acceleration = { 1500, 1500, 1500 }, @@ -58,7 +71,7 @@ settings_t settings_box = { // experimental settings for the Cetus3D // the steps_per_mm for the extruder has been measured on a prototype -settings_t settings_cetus = { +settings_t settings_cetus = { .steps_per_mm = { 160.0, 160.0, 236.0 }, .max_rate = { 200, 200, 50 }, .acceleration = { 1500, 1500, 1500 }, diff --git a/UP3DCOMMON/up3dconf.h b/UP3DCOMMON/up3dconf.h index ffd3d48..86eddbd 100644 --- a/UP3DCOMMON/up3dconf.h +++ b/UP3DCOMMON/up3dconf.h @@ -1,7 +1,7 @@ /* up3dconf.h for UP3DTranscoder M. Stohn 2016 - + This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -28,7 +28,7 @@ #define N_AXIS 3 // Number of axes (X,Y,A) -#define X_AXIS 0 // Axis indexing value. +#define X_AXIS 0 // Axis indexing value. #define Y_AXIS 1 #define A_AXIS 2 @@ -62,6 +62,7 @@ typedef struct { extern settings_t settings; extern settings_t settings_mini; +extern settings_t settings_mini2; extern settings_t settings_classic_plus; extern settings_t settings_box; extern settings_t settings_cetus; diff --git a/UP3DTRANSCODE/up3dtranscode.c b/UP3DTRANSCODE/up3dtranscode.c index 9fd544e..c9fb075 100644 --- a/UP3DTRANSCODE/up3dtranscode.c +++ b/UP3DTRANSCODE/up3dtranscode.c @@ -31,7 +31,7 @@ void print_usage_and_exit() { printf("Usage: up3dtranscode machinetype input.gcode output.umc nozzleheight [a_factor%%] [vmax_factor%%] [junction]\n\n"); - printf(" machinetype: mini / classic / plus / box / Cetus\n"); + printf(" machinetype: mini / mini2 / classic / plus / box / Cetus\n"); printf(" input.gcode: g-code file from slic3r/cura/simplify\n"); printf(" output.umc: up machine code file which will be generated\n"); printf(" nozzleheight: nozzle distance from bed (e.g. 123.45)\n"); @@ -44,26 +44,31 @@ void print_usage_and_exit() int main(int argc, char *argv[]) { bool power_off = true; - + if( 5 > argc || 8 < argc ) print_usage_and_exit(); switch( argv[1][0] ) { - case 'm': //mini - memcpy( &settings, &settings_mini, sizeof(settings) ); + // TODO: Support both mini and mini2 + case 'm': //mini 2 + memcpy( &settings, &settings_mini2, sizeof(settings) ); break; + /*case 'm': //mini*/ + /* memcpy( &settings, &settings_mini, sizeof(settings) );*/ + /* break;*/ + case 'c': //classic case 'p': //plus memcpy( &settings, &settings_classic_plus, sizeof(settings) ); break; - + case 'b': //box memcpy( &settings, &settings_box, sizeof(settings) ); break; - - case 'C': //cetus + + case 'C': //cetus memcpy( &settings, &settings_cetus, sizeof(settings) ); power_off = false; break; @@ -72,7 +77,7 @@ int main(int argc, char *argv[]) printf("ERROR: Uknown machine type: %s\n\n",argv[1] ); print_usage_and_exit(); } - + if (6 <= argc) { double factor; @@ -114,7 +119,7 @@ int main(int argc, char *argv[]) settings.junction_deviation = junction; //printf(";use junction %.5f\n", junction); } - + double nozzle_height; if( 1 != sscanf(argv[4],"%lf", &nozzle_height) ) {