Messa in campo 4 file - 26/06/2020 Francia
Dependencies: mbed X_NUCLEO_IHM03A1_for
Fork of FORIGO_Modula_V7_3_VdcStep_maggio2020 by
Diff: main.cpp
- Revision:
- 37:0a225902cf48
- Parent:
- 36:896cd03314f1
- Child:
- 38:79af1c65dd6f
--- a/main.cpp Wed Apr 22 07:50:37 2020 +0000 +++ b/main.cpp Wed Apr 22 08:50:26 2020 +0000 @@ -767,6 +767,81 @@ void stepSetting() { // Stepper driver init and set + TBmotorRst=1; // reset stepper driver + // M1 M2 M3 RESOLUTION + // 0 0 0 1/2 + // 1 0 0 1/8 + // 0 1 0 1/16 + // 1 1 0 1/32 + // 0 0 1 1/64 + // 1 0 1 1/128 + // 0 1 1 1/10 + // 1 1 1 1/20 + if (TBmotorSteps==400.0f){ + TBmotor_M1=1;//0; + TBmotor_M2=1;//0; + TBmotor_M3=1;//0; + #if defined(pcSerial) + pc.printf("Steps 400\n"); + #endif + }else if (TBmotorSteps==1600.0f){ + TBmotor_M1=0;//0; + TBmotor_M2=1;//1; + TBmotor_M3=1;//1; + #if defined(pcSerial) + pc.printf("Steps 1600\n"); + #endif + }else if (TBmotorSteps==3200.0f){ + TBmotor_M1=1;//0; + TBmotor_M2=0;//1; + TBmotor_M3=1;//0; + #if defined(pcSerial) + pc.printf("Steps 3200\n"); + #endif + }else if (TBmotorSteps==6400.0f){ + TBmotor_M1=0;//1; + TBmotor_M2=0;//1; + TBmotor_M3=1;//0; + #if defined(pcSerial) + pc.printf("Steps 6400\n"); + #endif + }else if (TBmotorSteps==12800.0f){ + TBmotor_M1=1;//0; + TBmotor_M2=1;//0; + TBmotor_M3=0;//1; + #if defined(pcSerial) + pc.printf("Steps 12800\n"); + #endif + }else if (TBmotorSteps==25600.0f){ + TBmotor_M1=0;//1; + TBmotor_M2=1;//0; + TBmotor_M3=0;//1; + #if defined(pcSerial) + pc.printf("Steps 25600\n"); + #endif + }else if (TBmotorSteps==2000.0f){ + TBmotor_M1=1;//0; + TBmotor_M2=0;//1; + TBmotor_M3=0;//1; + #if defined(pcSerial) + pc.printf("Steps 2000\n"); + #endif + }else if (TBmotorSteps==4000.0f){ + TBmotor_M1=0;//1; + TBmotor_M2=0;//1; + TBmotor_M3=0;//1; + #if defined(pcSerial) + pc.printf("Steps 4000\n"); + #endif + }else{ + // set dei 1600 passi + TBmotor_M1=0; + TBmotor_M2=1; + TBmotor_M3=1; + #if defined(pcSerial) + pc.printf("Step standard\n"); + #endif + } TBmotorRst=0; // reset stepper driver TBmotorDirecti=TBforward; // reset stepper direction #if defined(pcSerial) @@ -1205,7 +1280,9 @@ uint16_t steps = (uint32_t) rxMsg.data[2]*0x00000100; steps = steps + ((uint32_t)rxMsg.data[1]); TBmotorSteps =steps; - //stepSetting(); + #if defined(oldStepperDriver) + stepSetting(); + #endif cellsCountSet = rxMsg.data[3]; if ((flags&0x01)==0x01) { if (encoder==false) { @@ -1546,9 +1623,13 @@ wait(1.0f); wait(ritAvv); - //stepSetting(); - - TBmotor_SW=1; + #if defined(oldStepperDriver) + stepSetting(); + #endif + + #if defined(runner) + TBmotor_SW=1; + #endif TBmotorDirecti=TBforward; // reset stepper direction //----- Initialization /* Initializing SPI bus. */ @@ -2024,10 +2105,9 @@ pc.printf("TBoldPos: %d\n",TBoldPosition); #endif #endif - #if defined(perProva) - pc.printf(" ildato %d Actual %d\n", ildato, TBactualPosition); - #endif - + #if defined(perProva) + pc.printf(" ildato %d Actual %d\n", ildato, TBactualPosition); + #endif #else TBactualPosition=0; #endif