Skip to content

Commit 264adf2

Browse files
committed
Uncounted changes :-)
1 parent fa34d17 commit 264adf2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1542
-831
lines changed

.github/workflows/TestCompile.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# TestCompile.yml
22
# Github workflow script to test compile all examples of an Arduino library repository.
33
#
4-
# Copyright (C) 2020 Armin Joachimsmeyer
4+
# Copyright (C) 2020-2023 Armin Joachimsmeyer
55
# https://github.com/ArminJo/Github-Actions
66
#
77

@@ -23,7 +23,8 @@ jobs:
2323
name: Test compiling examples for UNO
2424
runs-on: ubuntu-latest
2525
env:
26-
REQUIRED_LIBRARIES: Servo,Adafruit Motor Shield V2 Library,BlueDisplay,PlayRtttl
26+
REQUIRED_LIBRARIES: Servo,Adafruit Motor Shield V2 Library,PlayRtttl
27+
# REQUIRED_LIBRARIES: Servo,Adafruit Motor Shield V2 Library,PlayRtttl,BlueDisplay
2728
# REQUIRED_LIBRARIES: Servo,Adafruit Motor Shield V2 Library,BlueDisplay,PlayRtttl,SparkFun VL53L1X 4m Laser Distance Sensor
2829

2930
strategy:
@@ -32,7 +33,7 @@ jobs:
3233
- arduino:avr:uno
3334
- arduino:avr:uno|TimeOfFlight
3435
- arduino:avr:uno|BreadboardFull
35-
# - arduino:avr:uno|Mecanum
36+
- arduino:avr:uno|Mecanum
3637

3738
include:
3839
- arduino-boards-fqbn: arduino:avr:uno
@@ -59,13 +60,13 @@ jobs:
5960
-DUS_SENSOR_SUPPORTS_1_PIN_MODE
6061
-mcall-prologues # reduces size by 870 bytes
6162

62-
# - arduino-boards-fqbn: arduino:avr:uno|Mecanum # Nano board with TB6612 breakout board + 4 mecanum wheels
63-
# build-properties:
64-
# RobotCarBlueDisplay:
65-
# -DMECANUM_BASIC_CONFIGURATION
66-
# -DBLUETOOTH_BAUD_RATE=BAUD_115200
67-
# -DUS_SENSOR_SUPPORTS_1_PIN_MODE
68-
# -mcall-prologues # reduces size by 870 bytes
63+
- arduino-boards-fqbn: arduino:avr:uno|Mecanum # Nano board with TB6612 breakout board + 4 mecanum wheels
64+
build-properties:
65+
RobotCarBlueDisplay:
66+
-DMECANUM_BASIC_CONFIGURATION
67+
-DBLUETOOTH_BAUD_RATE=BAUD_115200
68+
-DUS_SENSOR_SUPPORTS_1_PIN_MODE
69+
-mcall-prologues # reduces size by 870 bytes
6970

7071
# Do not cancel all jobs / architectures if one job fails
7172
fail-fast: false
@@ -74,16 +75,17 @@ jobs:
7475
- name: Checkout
7576
uses: actions/checkout@master
7677

77-
# - name: Checkout new BlueDisplay library
78-
# uses: actions/checkout@v2
79-
# with:
80-
# repository: ArminJo/Arduino-BlueDisplay
81-
# ref: master
82-
# path: CustomLibrary_BD # must contain string "Custom"
78+
- name: Checkout new BlueDisplay library
79+
uses: actions/checkout@v3
80+
with:
81+
repository: ArminJo/Arduino-BlueDisplay
82+
ref: master
83+
path: CustomLibrary_BD # must contain string "Custom"
84+
# Must remove BlueDisplay from REQUIRED_LIBRARIES
8385

8486
# Currently included in source directory
8587
# - name: Checkout new PWMMotorControl library
86-
# uses: actions/checkout@v2
88+
# uses: actions/checkout@v3
8789
# with:
8890
# repository: ArminJo/PWMMotorControl
8991
# ref: master

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- To overcome the drawbacks of ultrasonic sensors, an additional IR or TOF (TimeOfFlight) sensor can be mounted to the servo.
1111
- Manual control is implemented by a GUI using a Bluetooth HC-05 Module and the [BlueDisplay library](https://github.com/ArminJo/Arduino-BlueDisplay).
1212

13-
**Just overwrite the function doUserCollisionDetection() to test your own skill**.
13+
**Just overwrite the function doUserCollisionAvoiding() to test your own skill**.
1414
You may also overwrite the function fillAndShowForwardDistancesInfo(), if you use your own scanning method.
1515

1616
This example requires the **[PWMMotorControl library](https://github.com/ArminJo/PWMMotorControl)** to control the motors,
@@ -26,6 +26,8 @@ the **[BlueDisplay library](https://github.com/ArminJo/BlueDisplay)** for Smartp
2626
| ![Encoder fork sensor](https://github.com/ArminJo/Arduino-RobotCar/blob/master/pictures/ForkSensor.jpg) | ![Servo mounting](https://github.com/ArminJo/Arduino-RobotCar/blob/master/pictures/ServoAtTopBack.jpg) |
2727
| VIN sensing with motor shield | Red car with Sharp GP2Y0A21YK distance sensor |
2828
| ![VIN sensing](https://github.com/ArminJo/Arduino-RobotCar/blob/master/pictures/SensingVIn.jpg) | https://github.com/ArminJo/Arduino-RobotCar/blob/master/pictures/RedCar.jpg |
29+
| Youtube video of mecanum demo | Youtube video of mecanum car controlled by the accelerator sensors of the tablet |
30+
| [![Arduino Mecanum Wheel Car Demo](https://i.ytimg.com/vi/https://youtu.be/VX92jeqr8_g/hqdefault.jpg)](https://www.youtube.com/watch?v=https://youtu.be/VX92jeqr8_g) | [![Arduino Mecanum Wheel Car Sensor Drive Demo](https://i.ytimg.com/vi/lhlxLTj9Mrg/hqdefault.jpg)](https://www.youtube.com/watch?v=lhlxLTj9Mrg) |
2931

3032
# SCREENSHOTS
3133
| Start page | Test page |
@@ -41,7 +43,7 @@ Automatic control page with detected wall at right
4143
- Red bars are distanced below the distance of one ride per scan (default 20 cm) -> collision during next "scan and ride" cycle if obstacle is ahead.
4244
- Yellow bars are the values between the 2 thresholds (default 20 cm to 40 cm).
4345
- The tiny white bars are the distances computed by the doWallDetection() function. They overlay the green (assumed timeout) values.
44-
- The tiny black bar is the rotation chosen by doCollisionDetection() function.
46+
- The tiny black bar is the rotation chosen by doCollisionAvoiding() function.
4547

4648
# Wall detection
4749
Ultrasonic distance measurement has a problem with walls.

media/MecanumWheelCar.jpg

317 KB
Loading

src/ADCUtils.h

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
*
1414
* This program is distributed in the hope that it will be useful,
1515
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17-
* GNU General Public License for more details.
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17+
* See the GNU General Public License for more details.
1818
*
1919
* You should have received a copy of the GNU General Public License
2020
* along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>.
@@ -24,9 +24,10 @@
2424
#ifndef _ADC_UTILS_H
2525
#define _ADC_UTILS_H
2626

27-
#if defined(__AVR__) && (!defined(__AVR_ATmega4809__))
2827
#include <Arduino.h>
29-
#if defined(ADATE)
28+
29+
#if defined(__AVR__) && defined(ADCSRA) && defined(ADATE) && (!defined(__AVR_ATmega4809__))
30+
#define ADC_UTILS_ARE_AVAILABLE
3031

3132
// PRESCALE4 => 13 * 4 = 52 microseconds per ADC conversion at 1 MHz Clock => 19,2 kHz
3233
#define ADC_PRESCALE2 1 // 26 microseconds per ADC conversion at 1 MHz
@@ -111,6 +112,12 @@
111112
#error "No temperature channel definitions specified for this AVR CPU"
112113
#endif
113114

115+
extern float sVCCVoltage;
116+
extern uint16_t sVCCVoltageMillivolt;
117+
118+
extern long sLastVoltageCheckMillis;
119+
extern uint8_t sVoltageTooLowCounter;
120+
114121
uint16_t readADCChannel(uint8_t aChannelNumber);
115122
uint16_t readADCChannelWithReference(uint8_t aChannelNumber, uint8_t aReference);
116123
uint16_t waitAndReadADCChannelWithReference(uint8_t aChannelNumber, uint8_t aReference);
@@ -127,19 +134,30 @@ uint16_t readUntil4ConsecutiveValuesAreEqual(uint8_t aChannelNumber, uint8_t aDe
127134

128135
uint8_t checkAndWaitForReferenceAndChannelToSwitch(uint8_t aChannelNumber, uint8_t aReference);
129136

130-
float getVCCVoltageSimple(void);
131-
uint16_t getVCCVoltageMillivoltSimple(void);
132-
float getTemperatureSimple(void);
133-
float getVCCVoltage(void);
134-
uint16_t getVCCVoltageMillivolt(void);
135-
uint16_t getVCCVoltageReadingFor1_1VoltReference(void);
137+
/*
138+
* readVCC*() functions store the result in sVCCVoltageMillivolt or sVCCVoltage
139+
*/
140+
float getVCCVoltageSimple();
141+
void readVCCVoltageSimple();
142+
uint16_t getVCCVoltageMillivoltSimple();
143+
void readVCCVoltageMillivoltSimple();
144+
float getVCCVoltage();
145+
void readVCCVoltage();
146+
uint16_t getVCCVoltageMillivolt();
147+
void readVCCVoltageMillivolt();
148+
uint16_t getVCCVoltageReadingFor1_1VoltReference();
136149
uint16_t printVCCVoltageMillivolt(Print *aSerial);
137-
void printVCCVoltageMillivolt(Print *aSerial, uint16_t aVCCVoltageMillivolt);
150+
void readAndPrintVCCVoltageMillivolt(Print *aSerial);
151+
138152
uint16_t getVoltageMillivolt(uint16_t aVCCVoltageMillivolt, uint8_t aADCChannelForVoltageMeasurement);
139153
uint16_t getVoltageMillivolt(uint8_t aADCChannelForVoltageMeasurement);
140154
uint16_t getVoltageMillivoltWith_1_1VoltReference(uint8_t aADCChannelForVoltageMeasurement);
141-
float getTemperature(void);
155+
float getTemperatureSimple();
156+
float getTemperature();
157+
158+
bool isVCCTooLowMultipleTimes();
159+
void resetVCCTooLowMultipleTimes();
160+
bool isVoltageTooLow();
142161

143-
#endif // defined(ADATE)
144-
#endif // defined(__AVR__)
162+
#endif // defined(__AVR__) ...
145163
#endif // _ADC_UTILS_H

0 commit comments

Comments
 (0)