# Door **Repository Path**: yangnd/door ## Basic Information - **Project Name**: Door - **Description**: No description available - **Primary Language**: C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-08 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README PWM PA6 TIM3_CH1 DIR PA5 PA7 open PE7 near_open PE8 closed PE9 near_closed PE10 current_sensor PC0 ADC123_IN10 (ACS712 20A:100mV/A 30A:66mV/A zore current:Vcc/2) DoorState bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 close_clamp open_clamp close_timeout open_timeout closing opning closed opened ErrorCode bit7~2 bit1 bit0 DRIVER_OR_MOTO_ERROR LIMIT_ERROR can指令byte0 bit7~3:reserved bit2:manual_disable bit1:close bit0:open 存在can开关指令或手动指令禁止时,手动按钮无效 接近开关动作时,对应的开关门指令无效 空闲IDLE: 开门OPEN: 接收到开门指令:门状态复位close_timeout 在未接收到开门到位信号时: 0~1s占空比调速0~70%电机加速,执行开门,门状态置opening 1~3s,70%占空比匀速,执行开门 3~10s,30%占空比匀速,执行开门 超过10s,停止开门,指令置为STOP,门状态复位opening,置open_timeout 开门过程中,若收到接近开门限位near_open,30%占空比匀速,执行开门 在开门超时前,接收到开门到位信号: 停止开门,指令置为STOP,门状态复位opening 关门CLOSE: 接收到关门指令:门状态复位open_timeout 在未接收到关门到位信号时: 0~1s占空比调速0~70%电机加速,执行关门,门状态置closing 1~3s,70%占空比匀速,执行关门 3~10s,30%占空比匀速,执行关门 超过10s,停止关门,指令置为STOP,门状态复位closing,置close_timeout 关门到位前,电流大于CLAMP_CURRENT,停止关门,指令置CLOSE_CLAMP,门状态置close_clamp,复位closing 在关门超时前,接收到关门到位信号: 当电流大于CLAMP_CURRENT时,停止关门,指令置为STOP,门状态复位closing 开门防夹OPEN_CLAMP: 关门防夹CLOSE_CLAMP: 指令置为OPEN 停止STOP: 停电机 指令置IDLE 故障ERROR: 停电机