zmiana pinu i czasu
This commit is contained in:
@@ -13,11 +13,11 @@
|
||||
#define LED_PWM_DDR DDRA
|
||||
#define LED_PWM_PORT PORTA
|
||||
|
||||
#define PROBE_OUT_PIN PB1
|
||||
#define PROBE_OUT_PIN PB0
|
||||
#define PROBE_OUT_DDR DDRB
|
||||
#define PROBE_OUT_PORT PORTB
|
||||
|
||||
#define ESTOP_OUT_PIN PB0
|
||||
#define ESTOP_OUT_PIN PB1
|
||||
#define ESTOP_OUT_DDR DDRB
|
||||
#define ESTOP_OUT_PORT PORTB
|
||||
|
||||
|
||||
10
src/main.c
10
src/main.c
@@ -77,7 +77,7 @@ int main(void)
|
||||
if (estop_triggered)
|
||||
{
|
||||
uint16_t now = ticks100us(); // Musisz mieć funkcję zwracającą czas w ms, np. z timer0
|
||||
if (now - last_blink_time >= 5000) // 0.5 sekundy
|
||||
if (now - last_blink_time >= 2000) // 0.5 sekundy
|
||||
{
|
||||
last_blink_time = now;
|
||||
blink_state = !blink_state;
|
||||
@@ -129,13 +129,14 @@ void probe_int_on(ButtonKey_t *key)
|
||||
|
||||
void probe_int_off(ButtonKey_t *key)
|
||||
{
|
||||
PROBE_OUT_PORT |= (1 << PROBE_OUT_PIN);
|
||||
|
||||
if (estop_triggered)
|
||||
{
|
||||
estop_triggered = 0; // Reset estop when probe back to normal
|
||||
led_set_color(LED_COLOR_RED, LED_RIGHT);
|
||||
}
|
||||
|
||||
PROBE_OUT_PORT |= (1 << PROBE_OUT_PIN);
|
||||
led_set_color(LED_COLOR_GREEN, LED_LEFT);
|
||||
|
||||
if (!ext_probe_connected)
|
||||
@@ -152,20 +153,21 @@ void probe_ext_on(ButtonKey_t *key)
|
||||
|
||||
void probe_ext_off(ButtonKey_t *key)
|
||||
{
|
||||
PROBE_OUT_PORT |= (1 << PROBE_OUT_PIN);
|
||||
|
||||
if (estop_triggered)
|
||||
{
|
||||
estop_triggered = 0; // Reset estop when probe back to normal
|
||||
led_set_color(LED_COLOR_GREEN, LED_LEFT);
|
||||
}
|
||||
|
||||
PROBE_OUT_PORT |= (1 << PROBE_OUT_PIN);
|
||||
led_set_color(LED_COLOR_RED, LED_RIGHT);
|
||||
}
|
||||
|
||||
void estop_on(ButtonKey_t *key)
|
||||
{
|
||||
estop_triggered = 1;
|
||||
ESTOP_OUT_PORT &= ~(1 << ESTOP_OUT_PIN);
|
||||
estop_triggered = 1;
|
||||
}
|
||||
|
||||
void estop_off(ButtonKey_t *key)
|
||||
|
||||
Reference in New Issue
Block a user