some renaming
This commit is contained in:
		@@ -199,7 +199,7 @@ void next_commutation_step(void) {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void start_motor(void){
 | 
			
		||||
void start_open_loop(void){
 | 
			
		||||
    nextCommutationStep = 0;
 | 
			
		||||
    //Preposition.
 | 
			
		||||
    gpio0::port_reg() = (gpio0::port_reg() & ~DRIVE_MASK) | driveTable[nextCommutationStep];
 | 
			
		||||
@@ -218,12 +218,10 @@ void start_motor(void){
 | 
			
		||||
        auto bemf = bemf_1>bemf_0?bemf_1-bemf_0:bemf_0-bemf_1;
 | 
			
		||||
        next_commutation_step();
 | 
			
		||||
        nextDrivePattern = driveTable[nextCommutationStep];
 | 
			
		||||
//        if(i>12 && bemf>32 && ((zcPolRise && bemf_0<2048 && bemf_1>2047) || (!zcPolRise && bemf_0>2047 && bemf_1<2048)))
 | 
			
		||||
//            return;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void run_motor(void){
 | 
			
		||||
void run_closed_loop(void){
 | 
			
		||||
    auto count=0;
 | 
			
		||||
    auto zc_delay=0U;
 | 
			
		||||
    auto tmp=0U;
 | 
			
		||||
@@ -241,9 +239,9 @@ void run_motor(void){
 | 
			
		||||
int main() {
 | 
			
		||||
    platform_init();
 | 
			
		||||
    printf("Starting motor\n");
 | 
			
		||||
	start_motor();
 | 
			
		||||
	start_open_loop();
 | 
			
		||||
    printf("done...\n");
 | 
			
		||||
    // Switch to sensorless commutation.
 | 
			
		||||
	run_motor();
 | 
			
		||||
    // Switch to sensor-less closed-loop commutation.
 | 
			
		||||
	run_closed_loop();
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user