From 9e304182077039afa86f170482f63657053bed7b Mon Sep 17 00:00:00 2001 From: Masatake Aoki Date: Thu, 6 Jun 2024 17:11:20 +0900 Subject: [PATCH 1/8] Fixed due to esp32 package 3.0.1 update --- uROS_STEP10_tfMsg/interrupt.ino | 2 +- uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino | 30 ++++---- .../uROS_STEP11_SensorMsg.ino | 10 +-- uROS_STEP12_micromouse/SPIFFS.ino | 2 +- uROS_STEP12_micromouse/adjust.ino | 2 +- uROS_STEP12_micromouse/device.h | 1 - uROS_STEP12_micromouse/device.ino | 75 +++++++++---------- uROS_STEP12_micromouse/fast.ino | 2 +- uROS_STEP12_micromouse/interrupt.ino | 2 +- uROS_STEP12_micromouse/map_manager.ino | 2 +- uROS_STEP12_micromouse/microROS.ino | 2 +- uROS_STEP12_micromouse/misc.ino | 2 +- uROS_STEP12_micromouse/run.ino | 2 +- uROS_STEP12_micromouse/search.ino | 2 +- .../uROS_STEP12_micromouse.ino | 2 +- uROS_STEP1_LED/uROS_STEP1_LED.ino | 2 +- uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino | 2 +- uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino | 35 +++++---- uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino | 10 +-- uROS_STEP5_Straight/interrupt.ino | 2 +- uROS_STEP5_Straight/run.ino | 2 +- uROS_STEP5_Straight/uROS_STEP5_Straight.ino | 30 ++++---- uROS_STEP6_rotate/interrupt.ino | 2 +- uROS_STEP6_rotate/run.ino | 2 +- uROS_STEP6_rotate/uROS_STEP6_rotate.ino | 30 ++++---- uROS_STEP7_P_control/interrupt.ino | 2 +- uROS_STEP7_P_control/run.ino | 2 +- uROS_STEP7_P_control/uROS_STEP7_P_control.ino | 44 +++++------ uROS_STEP8_micromouse/SPIFFS.ino | 2 +- uROS_STEP8_micromouse/adjust.ino | 2 +- uROS_STEP8_micromouse/device.h | 2 - uROS_STEP8_micromouse/device.ino | 63 ++++++++-------- uROS_STEP8_micromouse/fast.ino | 2 +- uROS_STEP8_micromouse/interrupt.ino | 2 +- uROS_STEP8_micromouse/map_manager.ino | 2 +- uROS_STEP8_micromouse/misc.ino | 2 +- uROS_STEP8_micromouse/run.ino | 2 +- uROS_STEP8_micromouse/search.ino | 2 +- .../uROS_STEP8_micromouse.ino | 2 +- uROS_STEP9_twistMsg/interrupt.ino | 2 +- uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino | 30 ++++---- 41 files changed, 204 insertions(+), 214 deletions(-) diff --git a/uROS_STEP10_tfMsg/interrupt.ino b/uROS_STEP10_tfMsg/interrupt.ino index db076ae..0f0e6bb 100644 --- a/uROS_STEP10_tfMsg/interrupt.ino +++ b/uROS_STEP10_tfMsg/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino b/uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino index fa90d05..9bed5e0 100644 --- a/uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino +++ b/uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -136,7 +136,7 @@ void IRAM_ATTR isrR(void) portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { if (g_step_hz_r < 30) g_step_hz_r = 30; - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -153,7 +153,7 @@ void IRAM_ATTR isrL(void) portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { if (g_step_hz_l < 30) g_step_hz_l = 30; - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -201,20 +201,20 @@ void setup() delay(2000); - g_timer0 = timerBegin(0, 80, true); //1us - timerAttachInterrupt(g_timer0, &onTimer0, true); - timerAlarmWrite(g_timer0, 1000, true); //1kHz - timerAlarmEnable(g_timer0); + g_timer0 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerStart(g_timer0); - g_timer2 = timerBegin(2, 40, true); //0.5us - timerAttachInterrupt(g_timer2, &isrR, true); - timerAlarmWrite(g_timer2, 13333, true); //150Hz - timerAlarmEnable(g_timer2); + g_timer2 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer2, &isrR); + timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerStart(g_timer2); - g_timer3 = timerBegin(3, 40, true); //0.5us - timerAttachInterrupt(g_timer3, &isrL, true); - timerAlarmWrite(g_timer3, 13333, true); //150Hz - timerAlarmEnable(g_timer3); + g_timer3 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerStart(g_timer3); g_allocator = rcl_get_default_allocator(); diff --git a/uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino b/uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino index 4d36b25..a064bfc 100644 --- a/uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino +++ b/uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -163,10 +163,10 @@ void setup() delay(2000); - g_timer1 = timerBegin(1, 80, true); //1us - timerAttachInterrupt(g_timer1, &onTimer1, true); - timerAlarmWrite(g_timer1, 250, true); //4kHz - timerAlarmEnable(g_timer1); + g_timer1 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer1, &onTimer1); + timerAlarm(g_timer1, 250, true, 0); //4kHz + timerStart(g_timer1); g_allocator = rcl_get_default_allocator(); diff --git a/uROS_STEP12_micromouse/SPIFFS.ino b/uROS_STEP12_micromouse/SPIFFS.ino index 3a8e044..6bee69a 100644 --- a/uROS_STEP12_micromouse/SPIFFS.ino +++ b/uROS_STEP12_micromouse/SPIFFS.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/adjust.ino b/uROS_STEP12_micromouse/adjust.ino index b0133f2..f57bae2 100644 --- a/uROS_STEP12_micromouse/adjust.ino +++ b/uROS_STEP12_micromouse/adjust.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/device.h b/uROS_STEP12_micromouse/device.h index 8dddc49..1dd901b 100644 --- a/uROS_STEP12_micromouse/device.h +++ b/uROS_STEP12_micromouse/device.h @@ -36,6 +36,5 @@ #define SW_CM 2 #define SW_RM 4 -#define BUZZER_CH 0 #endif // DEVICE_H_ \ No newline at end of file diff --git a/uROS_STEP12_micromouse/device.ino b/uROS_STEP12_micromouse/device.ino index 61ed13b..651c377 100644 --- a/uROS_STEP12_micromouse/device.ino +++ b/uROS_STEP12_micromouse/device.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ void IRAM_ATTR isrR(void) portENTER_CRITICAL_ISR(&g_timer_mux); if (g_motor_move) { if (g_step_hz_r < 30) g_step_hz_r = 30; - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -76,7 +76,7 @@ void IRAM_ATTR isrL(void) portENTER_CRITICAL_ISR(&g_timer_mux); if (g_motor_move) { if (g_step_hz_l < 30) g_step_hz_l = 30; - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -87,21 +87,21 @@ void IRAM_ATTR isrL(void) portEXIT_CRITICAL_ISR(&g_timer_mux); } -void controlInterruptStart(void) { timerAlarmEnable(g_timer0); } -void controlInterruptStop(void) { timerAlarmDisable(g_timer0); } +void controlInterruptStart(void) { timerStart(g_timer0); } +void controlInterruptStop(void) { timerStop(g_timer0); } -void sensorInterruptStart(void) { timerAlarmEnable(g_timer1); } -void sensorInterruptStop(void) { timerAlarmDisable(g_timer1); } +void sensorInterruptStart(void) { timerStart(g_timer1); } +void sensorInterruptStop(void) { timerStop(g_timer1); } void PWMInterruptStart(void) { - timerAlarmEnable(g_timer2); - timerAlarmEnable(g_timer3); + timerStart(g_timer2); + timerStart(g_timer3); } void PWMInterruptStop(void) { - timerAlarmDisable(g_timer2); - timerAlarmDisable(g_timer3); + timerStop(g_timer2); + timerStop(g_timer3); } void initDevice(void) @@ -118,9 +118,8 @@ void initDevice(void) pinMode(SW_C, INPUT); pinMode(SW_R, INPUT); - ledcSetup(0, 440, 10); - ledcAttachPin(BUZZER, 0); - ledcWrite(0, 1024); + ledcAttach(BUZZER, 440, 10); + ledcWrite(BUZZER, 1024); pinMode(SLED_FR, OUTPUT); pinMode(SLED_FL, OUTPUT); @@ -149,25 +148,25 @@ void initDevice(void) } } - g_timer0 = timerBegin(0, 80, true); - timerAttachInterrupt(g_timer0, &onTimer0, false); - timerAlarmWrite(g_timer0, 1000, true); - timerAlarmEnable(g_timer0); + g_timer0 = timerBegin(1000000); + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); + timerStart(g_timer0); - g_timer1 = timerBegin(1, 80, true); - timerAttachInterrupt(g_timer1, &onTimer1, true); - timerAlarmWrite(g_timer1, 500, true); - timerAlarmEnable(g_timer1); + g_timer1 = timerBegin(1000000); + timerAttachInterrupt(g_timer1, &onTimer1); + timerAlarm(g_timer1, 500, true, 0); + timerStart(g_timer1); - g_timer2 = timerBegin(2, 40, true); - timerAttachInterrupt(g_timer2, &isrR, false); - timerAlarmWrite(g_timer2, 13333, true); - timerAlarmEnable(g_timer2); + g_timer2 = timerBegin(2000000); + timerAttachInterrupt(g_timer2, &isrR); + timerAlarm(g_timer2, 13333, true, 0); + timerStart(g_timer2); - g_timer3 = timerBegin(3, 40, true); - timerAttachInterrupt(g_timer3, &isrL, false); - timerAlarmWrite(g_timer3, 13333, true); - timerAlarmEnable(g_timer3); + g_timer3 = timerBegin(2000000); + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); + timerStart(g_timer3); Serial.begin(115200); @@ -199,10 +198,10 @@ void setBLED(char data) } //Buzzer -void enableBuzzer(short f) { ledcWriteTone(BUZZER_CH, f); } +void enableBuzzer(short f) { ledcWriteTone(BUZZER, f); } void disableBuzzer(void) { - ledcWrite(BUZZER_CH, 1024); //duty 100% Buzzer OFF + ledcWrite(BUZZER, 1024); //duty 100% Buzzer OFF } //motor @@ -266,8 +265,7 @@ unsigned short getSensorR(void) for (int i = 0; i < WAITLOOP_SLED; i++) { asm("nop \n"); } - // unsigned short tmp = analogRead(AD3); - unsigned short tmp = adc1_get_raw(ADC1_CHANNEL_5); + unsigned short tmp = analogRead(AD3); digitalWrite(SLED_R, LOW); return tmp; } @@ -277,8 +275,7 @@ unsigned short getSensorL(void) for (int i = 0; i < WAITLOOP_SLED; i++) { asm("nop \n"); } - // unsigned short tmp = analogRead(AD4); - unsigned short tmp = adc1_get_raw(ADC1_CHANNEL_6); + unsigned short tmp = analogRead(AD4); digitalWrite(SLED_L, LOW); return tmp; } @@ -288,8 +285,7 @@ unsigned short getSensorFL(void) for (int i = 0; i < WAITLOOP_SLED; i++) { asm("nop \n"); } - // unsigned short tmp = analogRead(AD2); - unsigned short tmp = adc1_get_raw(ADC1_CHANNEL_4); + unsigned short tmp = analogRead(AD2); digitalWrite(SLED_FL, LOW); //LED消灯 return tmp; } @@ -299,8 +295,7 @@ unsigned short getSensorFR(void) for (int i = 0; i < WAITLOOP_SLED; i++) { asm("nop \n"); } - // unsigned short tmp = analogRead(AD1); - unsigned short tmp = adc1_get_raw(ADC1_CHANNEL_3); + unsigned short tmp = analogRead(AD1); digitalWrite(SLED_FR, LOW); return tmp; } diff --git a/uROS_STEP12_micromouse/fast.ino b/uROS_STEP12_micromouse/fast.ino index 8981c34..28669ff 100644 --- a/uROS_STEP12_micromouse/fast.ino +++ b/uROS_STEP12_micromouse/fast.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/interrupt.ino b/uROS_STEP12_micromouse/interrupt.ino index f8fde48..9bd3b69 100644 --- a/uROS_STEP12_micromouse/interrupt.ino +++ b/uROS_STEP12_micromouse/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/map_manager.ino b/uROS_STEP12_micromouse/map_manager.ino index 809711d..9437fab 100644 --- a/uROS_STEP12_micromouse/map_manager.ino +++ b/uROS_STEP12_micromouse/map_manager.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/microROS.ino b/uROS_STEP12_micromouse/microROS.ino index 68108a7..6e67e37 100644 --- a/uROS_STEP12_micromouse/microROS.ino +++ b/uROS_STEP12_micromouse/microROS.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/misc.ino b/uROS_STEP12_micromouse/misc.ino index e59de6d..f1f714d 100644 --- a/uROS_STEP12_micromouse/misc.ino +++ b/uROS_STEP12_micromouse/misc.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/run.ino b/uROS_STEP12_micromouse/run.ino index f93cdcd..7d53828 100644 --- a/uROS_STEP12_micromouse/run.ino +++ b/uROS_STEP12_micromouse/run.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/search.ino b/uROS_STEP12_micromouse/search.ino index 2895011..d36d5e1 100644 --- a/uROS_STEP12_micromouse/search.ino +++ b/uROS_STEP12_micromouse/search.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino b/uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino index e2392a2..f8afc7e 100644 --- a/uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino +++ b/uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP1_LED/uROS_STEP1_LED.ino b/uROS_STEP1_LED/uROS_STEP1_LED.ino index d9dbb4c..64b57a4 100644 --- a/uROS_STEP1_LED/uROS_STEP1_LED.ino +++ b/uROS_STEP1_LED/uROS_STEP1_LED.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino b/uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino index fb762fc..c7760d3 100644 --- a/uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino +++ b/uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino b/uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino index 048f15f..0abbf9f 100644 --- a/uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino +++ b/uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -60,22 +60,22 @@ void execByMode(char mode) { switch (mode) { case 1: - ledcWriteTone(0, FREQ_C); + ledcWriteTone(BUZZER, FREQ_C); delay(1000); - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); break; case 2: - ledcWriteTone(0, FREQ_D); + ledcWriteTone(BUZZER, FREQ_D); delay(1000); - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); break; case 3: - ledcWriteTone(0, FREQ_E); + ledcWriteTone(BUZZER, FREQ_E); delay(1000); - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); break; default: - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); break; } } @@ -92,9 +92,8 @@ void setup() pinMode(SW_C, INPUT); pinMode(SW_R, INPUT); - ledcSetup(0, 440, 10); - ledcAttachPin(BUZZER, 0); - ledcWrite(0, 1024); + ledcAttach(BUZZER, 440, 10); + ledcWrite(BUZZER, 1024); g_mode = 1; setLED(g_mode); @@ -111,9 +110,9 @@ void loop() if (g_mode > 15) { g_mode = 15; } else { - ledcWriteTone(0, INC_FREQ); + ledcWriteTone(BUZZER, INC_FREQ); delay(30); - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); } setLED(g_mode); } @@ -122,18 +121,18 @@ void loop() if (g_mode < 1) { g_mode = 1; } else { - ledcWriteTone(0, DEC_FREQ); + ledcWriteTone(BUZZER, DEC_FREQ); delay(30); - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); } setLED(g_mode); } if (digitalRead(SW_C) == 0) { - ledcWriteTone(0, INC_FREQ); + ledcWriteTone(BUZZER, INC_FREQ); delay(80); - ledcWriteTone(0, DEC_FREQ); + ledcWriteTone(BUZZER, DEC_FREQ); delay(80); - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); delay(300); execByMode(g_mode); } diff --git a/uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino b/uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino index a5454e5..27e8879 100644 --- a/uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino +++ b/uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -94,10 +94,10 @@ void setup() Serial.begin(115200); - g_timer1 = timerBegin(1, 80, true); //1us - timerAttachInterrupt(g_timer1, &onTimer1, true); - timerAlarmWrite(g_timer1, 250, true); //4kHz - timerAlarmEnable(g_timer1); + g_timer1 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer1, &onTimer1); + timerAlarm(g_timer1, 250, true, 0); //4kHz + timerStart(g_timer1); } void loop() diff --git a/uROS_STEP5_Straight/interrupt.ino b/uROS_STEP5_Straight/interrupt.ino index 8d9e922..114ae10 100644 --- a/uROS_STEP5_Straight/interrupt.ino +++ b/uROS_STEP5_Straight/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP5_Straight/run.ino b/uROS_STEP5_Straight/run.ino index 55715d4..3bd137d 100644 --- a/uROS_STEP5_Straight/run.ino +++ b/uROS_STEP5_Straight/run.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP5_Straight/uROS_STEP5_Straight.ino b/uROS_STEP5_Straight/uROS_STEP5_Straight.ino index 6c77f5a..0cda8a1 100644 --- a/uROS_STEP5_Straight/uROS_STEP5_Straight.ino +++ b/uROS_STEP5_Straight/uROS_STEP5_Straight.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ void IRAM_ATTR isrR(void) { portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -79,7 +79,7 @@ void IRAM_ATTR isrL(void) { portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -115,20 +115,20 @@ void setup() digitalWrite(PWM_R, LOW); digitalWrite(PWM_L, LOW); - g_timer0 = timerBegin(0, 80, true); //1us - timerAttachInterrupt(g_timer0, &onTimer0, true); - timerAlarmWrite(g_timer0, 1000, true); //1kHz - timerAlarmEnable(g_timer0); + g_timer0 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerStart(g_timer0); - g_timer2 = timerBegin(2, 40, true); //0.5us - timerAttachInterrupt(g_timer2, isrR, true); - timerAlarmWrite(g_timer2, 13333, true); //150Hz - timerAlarmEnable(g_timer2); + g_timer2 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer2, isrR); + timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerStart(g_timer2); - g_timer3 = timerBegin(3, 40, true); //0.5us - timerAttachInterrupt(g_timer3, &isrL, true); - timerAlarmWrite(g_timer3, 13333, true); //150Hz - timerAlarmEnable(g_timer3); + g_timer3 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerStart(g_timer3); } void loop() diff --git a/uROS_STEP6_rotate/interrupt.ino b/uROS_STEP6_rotate/interrupt.ino index 8d9e922..114ae10 100644 --- a/uROS_STEP6_rotate/interrupt.ino +++ b/uROS_STEP6_rotate/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP6_rotate/run.ino b/uROS_STEP6_rotate/run.ino index 3b25a88..2ee3103 100644 --- a/uROS_STEP6_rotate/run.ino +++ b/uROS_STEP6_rotate/run.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP6_rotate/uROS_STEP6_rotate.ino b/uROS_STEP6_rotate/uROS_STEP6_rotate.ino index a4d6ff6..2ce0901 100644 --- a/uROS_STEP6_rotate/uROS_STEP6_rotate.ino +++ b/uROS_STEP6_rotate/uROS_STEP6_rotate.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ void IRAM_ATTR isrR(void) { portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -88,7 +88,7 @@ void IRAM_ATTR isrL(void) { portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -124,20 +124,20 @@ void setup() digitalWrite(PWM_R, LOW); digitalWrite(PWM_L, LOW); - g_timer0 = timerBegin(0, 80, true); //1us - timerAttachInterrupt(g_timer0, &onTimer0, true); - timerAlarmWrite(g_timer0, 1000, true); //1kHz - timerAlarmEnable(g_timer0); + g_timer0 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerStart(g_timer0); - g_timer2 = timerBegin(2, 40, true); //0.5us - timerAttachInterrupt(g_timer2, &isrR, true); - timerAlarmWrite(g_timer2, 13333, true); //150Hz - timerAlarmEnable(g_timer2); + g_timer2 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer2, &isrR); + timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerStart(g_timer2); - g_timer3 = timerBegin(3, 40, true); //0.5us - timerAttachInterrupt(g_timer3, &isrL, true); - timerAlarmWrite(g_timer3, 13333, true); //150Hz - timerAlarmEnable(g_timer3); + g_timer3 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerStart(g_timer3); } void loop() diff --git a/uROS_STEP7_P_control/interrupt.ino b/uROS_STEP7_P_control/interrupt.ino index 61b6ec4..49579b0 100644 --- a/uROS_STEP7_P_control/interrupt.ino +++ b/uROS_STEP7_P_control/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP7_P_control/run.ino b/uROS_STEP7_P_control/run.ino index 55715d4..3bd137d 100644 --- a/uROS_STEP7_P_control/run.ino +++ b/uROS_STEP7_P_control/run.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP7_P_control/uROS_STEP7_P_control.ino b/uROS_STEP7_P_control/uROS_STEP7_P_control.ino index cfeefa0..183cd65 100644 --- a/uROS_STEP7_P_control/uROS_STEP7_P_control.ino +++ b/uROS_STEP7_P_control/uROS_STEP7_P_control.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -127,7 +127,7 @@ void IRAM_ATTR isrR(void) { portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -143,7 +143,7 @@ void IRAM_ATTR isrL(void) { portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -190,25 +190,25 @@ void setup() Serial.begin(115200); - g_timer0 = timerBegin(0, 80, true); //1us - timerAttachInterrupt(g_timer0, &onTimer0, true); - timerAlarmWrite(g_timer0, 1000, true); //1kHz - timerAlarmEnable(g_timer0); - - g_timer1 = timerBegin(1, 80, true); - timerAttachInterrupt(g_timer1, &onTimer1, false); - timerAlarmWrite(g_timer1, 250, true); - timerAlarmEnable(g_timer1); - - g_timer2 = timerBegin(2, 40, true); //0.5us - timerAttachInterrupt(g_timer2, &isrR, true); - timerAlarmWrite(g_timer2, 13333, true); //150Hz - timerAlarmEnable(g_timer2); - - g_timer3 = timerBegin(3, 40, true); //0.5us - timerAttachInterrupt(g_timer3, &isrL, true); - timerAlarmWrite(g_timer3, 13333, true); //150Hz - timerAlarmEnable(g_timer3); + g_timer0 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerStart(g_timer0); + + g_timer1 = timerBegin(1000000); + timerAttachInterrupt(g_timer1, &onTimer1); + timerAlarm(g_timer1, 250, true, 0); + timerStart(g_timer1); + + g_timer2 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer2, &isrR); + timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerStart(g_timer2); + + g_timer3 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerStart(g_timer3); g_sen_r.ref = REF_SEN_R; g_sen_l.ref = REF_SEN_L; diff --git a/uROS_STEP8_micromouse/SPIFFS.ino b/uROS_STEP8_micromouse/SPIFFS.ino index 3a8e044..6bee69a 100644 --- a/uROS_STEP8_micromouse/SPIFFS.ino +++ b/uROS_STEP8_micromouse/SPIFFS.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/adjust.ino b/uROS_STEP8_micromouse/adjust.ino index 234775e..11769b9 100644 --- a/uROS_STEP8_micromouse/adjust.ino +++ b/uROS_STEP8_micromouse/adjust.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/device.h b/uROS_STEP8_micromouse/device.h index 8dddc49..b48bbbb 100644 --- a/uROS_STEP8_micromouse/device.h +++ b/uROS_STEP8_micromouse/device.h @@ -36,6 +36,4 @@ #define SW_CM 2 #define SW_RM 4 -#define BUZZER_CH 0 - #endif // DEVICE_H_ \ No newline at end of file diff --git a/uROS_STEP8_micromouse/device.ino b/uROS_STEP8_micromouse/device.ino index 821e6db..ec56717 100644 --- a/uROS_STEP8_micromouse/device.ino +++ b/uROS_STEP8_micromouse/device.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ void IRAM_ATTR isrR(void) portENTER_CRITICAL_ISR(&g_timer_mux); if (g_motor_move) { if (g_step_hz_r < 30) g_step_hz_r = 30; - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -69,7 +69,7 @@ void IRAM_ATTR isrL(void) portENTER_CRITICAL_ISR(&g_timer_mux); if (g_motor_move) { if (g_step_hz_l < 30) g_step_hz_l = 30; - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -80,21 +80,21 @@ void IRAM_ATTR isrL(void) portEXIT_CRITICAL_ISR(&g_timer_mux); } -void controlInterruptStart(void) { timerAlarmEnable(g_timer0); } -void controlInterruptStop(void) { timerAlarmDisable(g_timer0); } +void controlInterruptStart(void) { timerStart(g_timer0); } +void controlInterruptStop(void) { timerStop(g_timer0); } -void sensorInterruptStart(void) { timerAlarmEnable(g_timer1); } -void sensorInterruptStop(void) { timerAlarmDisable(g_timer1); } +void sensorInterruptStart(void) { timerStart(g_timer1); } +void sensorInterruptStop(void) { timerStop(g_timer1); } void PWMInterruptStart(void) { - timerAlarmEnable(g_timer2); - timerAlarmEnable(g_timer3); + timerStart(g_timer2); + timerStart(g_timer3); } void PWMInterruptStop(void) { - timerAlarmDisable(g_timer2); - timerAlarmDisable(g_timer3); + timerStop(g_timer2); + timerStop(g_timer3); } void initAll(void) @@ -111,9 +111,8 @@ void initAll(void) pinMode(SW_C, INPUT); pinMode(SW_R, INPUT); - ledcSetup(0, 440, 10); - ledcAttachPin(BUZZER, 0); - ledcWrite(0, 1024); + ledcAttach(BUZZER, 440, 10); + ledcWrite(BUZZER, 1024); pinMode(SLED_FR, OUTPUT); pinMode(SLED_FL, OUTPUT); @@ -142,25 +141,25 @@ void initAll(void) } } - g_timer0 = timerBegin(0, 80, true); - timerAttachInterrupt(g_timer0, &onTimer0, false); - timerAlarmWrite(g_timer0, 1000, true); - timerAlarmEnable(g_timer0); + g_timer0 = timerBegin(1000000); + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); + timerStart(g_timer0); - g_timer1 = timerBegin(1, 80, true); - timerAttachInterrupt(g_timer1, &onTimer1, false); - timerAlarmWrite(g_timer1, 250, true); - timerAlarmEnable(g_timer1); + g_timer1 = timerBegin(1000000); + timerAttachInterrupt(g_timer1, &onTimer1); + timerAlarm(g_timer1, 250, true, 0); + timerStart(g_timer1); - g_timer2 = timerBegin(2, 40, true); - timerAttachInterrupt(g_timer2, &isrR, false); - timerAlarmWrite(g_timer2, 13333, true); - timerAlarmEnable(g_timer2); + g_timer2 = timerBegin(2000000); + timerAttachInterrupt(g_timer2, &isrR); + timerAlarm(g_timer2, 13333, true, 0); + timerStart(g_timer2); - g_timer3 = timerBegin(3, 40, true); - timerAttachInterrupt(g_timer3, &isrL, false); - timerAlarmWrite(g_timer3, 13333, true); - timerAlarmEnable(g_timer3); + g_timer3 = timerBegin(2000000); + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); + timerStart(g_timer3); Serial.begin(115200); @@ -212,10 +211,10 @@ void setBLED(char data) } //Buzzer -void enableBuzzer(short f) { ledcWriteTone(BUZZER_CH, f); } +void enableBuzzer(short f) { ledcWriteTone(BUZZER, f); } void disableBuzzer(void) { - ledcWrite(BUZZER_CH, 1024); //duty 100% Buzzer OFF + ledcWrite(BUZZER, 1024); //duty 100% Buzzer OFF } //motor diff --git a/uROS_STEP8_micromouse/fast.ino b/uROS_STEP8_micromouse/fast.ino index ac4ec9e..0e1fe5b 100644 --- a/uROS_STEP8_micromouse/fast.ino +++ b/uROS_STEP8_micromouse/fast.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/interrupt.ino b/uROS_STEP8_micromouse/interrupt.ino index a6397ad..af6c3ed 100644 --- a/uROS_STEP8_micromouse/interrupt.ino +++ b/uROS_STEP8_micromouse/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/map_manager.ino b/uROS_STEP8_micromouse/map_manager.ino index caa4ef9..2648095 100644 --- a/uROS_STEP8_micromouse/map_manager.ino +++ b/uROS_STEP8_micromouse/map_manager.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/misc.ino b/uROS_STEP8_micromouse/misc.ino index e59de6d..f1f714d 100644 --- a/uROS_STEP8_micromouse/misc.ino +++ b/uROS_STEP8_micromouse/misc.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/run.ino b/uROS_STEP8_micromouse/run.ino index ebdc1d2..bb28f40 100644 --- a/uROS_STEP8_micromouse/run.ino +++ b/uROS_STEP8_micromouse/run.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/search.ino b/uROS_STEP8_micromouse/search.ino index 4ba97ae..c17d05f 100644 --- a/uROS_STEP8_micromouse/search.ino +++ b/uROS_STEP8_micromouse/search.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/uROS_STEP8_micromouse.ino b/uROS_STEP8_micromouse/uROS_STEP8_micromouse.ino index 0853d59..f2dfd0f 100644 --- a/uROS_STEP8_micromouse/uROS_STEP8_micromouse.ino +++ b/uROS_STEP8_micromouse/uROS_STEP8_micromouse.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP9_twistMsg/interrupt.ino b/uROS_STEP9_twistMsg/interrupt.ino index f693cde..8618f83 100644 --- a/uROS_STEP9_twistMsg/interrupt.ino +++ b/uROS_STEP9_twistMsg/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino b/uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino index 8cf5d5e..a80bebf 100644 --- a/uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino +++ b/uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -109,7 +109,7 @@ void IRAM_ATTR isrR(void) portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { if (g_step_hz_r < 30) g_step_hz_r = 30; - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -126,7 +126,7 @@ void IRAM_ATTR isrL(void) portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { if (g_step_hz_l < 30) g_step_hz_l = 30; - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -174,20 +174,20 @@ void setup() delay(2000); - g_timer0 = timerBegin(0, 80, true); //1us - timerAttachInterrupt(g_timer0, &onTimer0, true); - timerAlarmWrite(g_timer0, 1000, true); //1kHz - timerAlarmEnable(g_timer0); + g_timer0 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerStart(g_timer0); - g_timer2 = timerBegin(2, 40, true); //0.5us - timerAttachInterrupt(g_timer2, &isrR, true); - timerAlarmWrite(g_timer2, 13333, true); //150Hz - timerAlarmEnable(g_timer2); + g_timer2 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer2, &isrR); + timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerStart(g_timer2); - g_timer3 = timerBegin(3, 40, true); //0.5us - timerAttachInterrupt(g_timer3, &isrL, true); - timerAlarmWrite(g_timer3, 13333, true); //150Hz - timerAlarmEnable(g_timer3); + g_timer3 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerStart(g_timer3); g_allocator = rcl_get_default_allocator(); From 6fde1ee5553162b4cd4fe2bc427a4c3f9686cf5b Mon Sep 17 00:00:00 2001 From: ShotaAk Date: Tue, 18 Jun 2024 14:12:24 +0900 Subject: [PATCH 2/8] Update CI to build with arduino-esp32 v3.0.1 --- .github/workflows/compile-sketches.yaml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile-sketches.yaml b/.github/workflows/compile-sketches.yaml index 4723fa9..d73f551 100644 --- a/.github/workflows/compile-sketches.yaml +++ b/.github/workflows/compile-sketches.yaml @@ -28,7 +28,7 @@ jobs: platforms: | # ESP32公式のpackage indexを使用する - name: esp32:esp32 source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json - version: 2.0.17 + version: 3.0.1 libraries: | # RTがカスタマイズしたmicro_ros_arduinoライブラリを使用する - source-url: https://github.com/rt-net/micro_ros_arduino/archive/refs/tags/esp32s3-230417.zip cli-compile-flags: | # 警告がエラーとして扱われるので、対処しない警告はエラーから除外する diff --git a/README.md b/README.md index 48b3afe..ddff7d5 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Pi:Co Classic3用のmicro-ROS Arduinoサンプルスケッチ集です。 ## 動作環境 -- arduino-esp32 : v2.0.17 +- arduino-esp32 : v3.0.1 ## サンプルスケッチについて From 6207bc08927271a94610876330b3c120c057f672 Mon Sep 17 00:00:00 2001 From: ShotaAk Date: Tue, 18 Jun 2024 14:52:05 +0900 Subject: [PATCH 3/8] disable libraries --- .github/workflows/compile-sketches.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile-sketches.yaml b/.github/workflows/compile-sketches.yaml index d73f551..48df234 100644 --- a/.github/workflows/compile-sketches.yaml +++ b/.github/workflows/compile-sketches.yaml @@ -29,8 +29,8 @@ jobs: - name: esp32:esp32 source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json version: 3.0.1 - libraries: | # RTがカスタマイズしたmicro_ros_arduinoライブラリを使用する - - source-url: https://github.com/rt-net/micro_ros_arduino/archive/refs/tags/esp32s3-230417.zip + # libraries: | # RTがカスタマイズしたmicro_ros_arduinoライブラリを使用する + # - source-url: https://github.com/rt-net/micro_ros_arduino/archive/refs/tags/esp32s3-230417.zip cli-compile-flags: | # 警告がエラーとして扱われるので、対処しない警告はエラーから除外する - --build-property - "compiler.cpp.extra_flags= \ From 26f54257fb78bef7f3786dfc3c481cbd09a44aff Mon Sep 17 00:00:00 2001 From: ShotaAk Date: Tue, 18 Jun 2024 15:10:12 +0900 Subject: [PATCH 4/8] disable compile flag --- .github/workflows/compile-sketches.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/compile-sketches.yaml b/.github/workflows/compile-sketches.yaml index 48df234..35d207d 100644 --- a/.github/workflows/compile-sketches.yaml +++ b/.github/workflows/compile-sketches.yaml @@ -31,10 +31,10 @@ jobs: version: 3.0.1 # libraries: | # RTがカスタマイズしたmicro_ros_arduinoライブラリを使用する # - source-url: https://github.com/rt-net/micro_ros_arduino/archive/refs/tags/esp32s3-230417.zip - cli-compile-flags: | # 警告がエラーとして扱われるので、対処しない警告はエラーから除外する - - --build-property - - "compiler.cpp.extra_flags= \ - -Wno-error=type-limits" # micro_ros_arduino側のエラーを防ぐ + # cli-compile-flags: | # 警告がエラーとして扱われるので、対処しない警告はエラーから除外する + # - --build-property + # - "compiler.cpp.extra_flags= \ + # -Wno-error=type-limits" # micro_ros_arduino側のエラーを防ぐ sketch-paths: | - uROS_STEP1_LED - uROS_STEP2_SWITCH From 81f7537bca2fec54d0d75efeeac83bbd7cd1a45b Mon Sep 17 00:00:00 2001 From: ShotaAk Date: Tue, 18 Jun 2024 15:19:26 +0900 Subject: [PATCH 5/8] update --- .github/workflows/compile-sketches.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/compile-sketches.yaml b/.github/workflows/compile-sketches.yaml index 35d207d..8e6728b 100644 --- a/.github/workflows/compile-sketches.yaml +++ b/.github/workflows/compile-sketches.yaml @@ -29,12 +29,15 @@ jobs: - name: esp32:esp32 source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json version: 3.0.1 - # libraries: | # RTがカスタマイズしたmicro_ros_arduinoライブラリを使用する - # - source-url: https://github.com/rt-net/micro_ros_arduino/archive/refs/tags/esp32s3-230417.zip - # cli-compile-flags: | # 警告がエラーとして扱われるので、対処しない警告はエラーから除外する - # - --build-property - # - "compiler.cpp.extra_flags= \ - # -Wno-error=type-limits" # micro_ros_arduino側のエラーを防ぐ + libraries: | # RTがカスタマイズしたmicro_ros_arduinoライブラリを使用する + - source-url: https://github.com/rt-net/micro_ros_arduino/archive/refs/tags/esp32s3-230417.zip + + # 警告がエラーとして扱われるので、対処しない警告はエラーから除外する + # type-limitsはmicro_ros_arduino側のエラーを防ぐために除外します + cli-compile-flags: | + - --build-property + - "compiler.cpp.extra_flags= \ + -Wno-error=type-limits" sketch-paths: | - uROS_STEP1_LED - uROS_STEP2_SWITCH From d3409a739bb5220df8e3ca6ecf846741ac5022b3 Mon Sep 17 00:00:00 2001 From: ShotaAk Date: Tue, 18 Jun 2024 15:26:34 +0900 Subject: [PATCH 6/8] disable compile flag --- .github/workflows/compile-sketches.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/compile-sketches.yaml b/.github/workflows/compile-sketches.yaml index 8e6728b..c4f4f27 100644 --- a/.github/workflows/compile-sketches.yaml +++ b/.github/workflows/compile-sketches.yaml @@ -34,10 +34,10 @@ jobs: # 警告がエラーとして扱われるので、対処しない警告はエラーから除外する # type-limitsはmicro_ros_arduino側のエラーを防ぐために除外します - cli-compile-flags: | - - --build-property - - "compiler.cpp.extra_flags= \ - -Wno-error=type-limits" + # cli-compile-flags: | + # - --build-property + # - "compiler.cpp.extra_flags= \ + # -Wno-error=type-limits" sketch-paths: | - uROS_STEP1_LED - uROS_STEP2_SWITCH From a32a30e77b9fbdcde6f6cac86a37eb3124ccbb7b Mon Sep 17 00:00:00 2001 From: ShotaAk Date: Tue, 18 Jun 2024 15:41:04 +0900 Subject: [PATCH 7/8] update compiler flag --- .github/workflows/compile-sketches.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/compile-sketches.yaml b/.github/workflows/compile-sketches.yaml index c4f4f27..b4c75ad 100644 --- a/.github/workflows/compile-sketches.yaml +++ b/.github/workflows/compile-sketches.yaml @@ -34,10 +34,9 @@ jobs: # 警告がエラーとして扱われるので、対処しない警告はエラーから除外する # type-limitsはmicro_ros_arduino側のエラーを防ぐために除外します - # cli-compile-flags: | - # - --build-property - # - "compiler.cpp.extra_flags= \ - # -Wno-error=type-limits" + cli-compile-flags: | + - --build-property + - compiler.cpp.extra_flags=-Wno-error=type-limits sketch-paths: | - uROS_STEP1_LED - uROS_STEP2_SWITCH From a92c8de7c5faa2f98ff04a076a11ccf336b9e6fd Mon Sep 17 00:00:00 2001 From: ShotaAk Date: Tue, 18 Jun 2024 15:59:09 +0900 Subject: [PATCH 8/8] remove compiler flag --- .github/workflows/compile-sketches.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/compile-sketches.yaml b/.github/workflows/compile-sketches.yaml index b4c75ad..392da76 100644 --- a/.github/workflows/compile-sketches.yaml +++ b/.github/workflows/compile-sketches.yaml @@ -31,12 +31,6 @@ jobs: version: 3.0.1 libraries: | # RTがカスタマイズしたmicro_ros_arduinoライブラリを使用する - source-url: https://github.com/rt-net/micro_ros_arduino/archive/refs/tags/esp32s3-230417.zip - - # 警告がエラーとして扱われるので、対処しない警告はエラーから除外する - # type-limitsはmicro_ros_arduino側のエラーを防ぐために除外します - cli-compile-flags: | - - --build-property - - compiler.cpp.extra_flags=-Wno-error=type-limits sketch-paths: | - uROS_STEP1_LED - uROS_STEP2_SWITCH