Skip to content

Firmware support for RTR_520 with ESP32#272

Merged
thias15 merged 10 commits into
masterfrom
thias15/esp32-firmware
Apr 4, 2022
Merged

Firmware support for RTR_520 with ESP32#272
thias15 merged 10 commits into
masterfrom
thias15/esp32-firmware

Conversation

@thias15

@thias15 thias15 commented Mar 31, 2022

Copy link
Copy Markdown
Collaborator

No description provided.

@thias15 thias15 self-assigned this Mar 31, 2022

@quentin-leboutet quentin-leboutet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The min and max functions need to be redefined so get it to build properly. Once this is done, I confirm that I can control the RTR_520 vehicle.

const int PIN_LED_LI = 4;
const int PIN_LED_RI = 7;
//-------------------------RTR_520----------------------//
#elif (OPENBOT == RTR_520)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to redefine the min and max functions to get it to build:

#define max(a, b)                   \
    (                               \
        {                           \
            __typeof__(a) _a = (a); \
            __typeof__(b) _b = (b); \
            _a > _b ? _a : _b;      \
        })

#define min(a, b)                   \
    (                               \
        {                           \
            __typeof__(a) _a = (a); \
            __typeof__(b) _b = (b); \
            _a < _b ? _a : _b;      \
        })

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be fixed now with the fix below.

Comment thread firmware/openbot_nano/openbot_nano.ino Outdated
const float US_TO_CM = 0.01715; //cm/uS -> (343 * 100 / 1000000) / 2;
const unsigned int MAX_SONAR_DISTANCE = -1; //cm
const unsigned int MAX_SONAR_DISTANCE = 300; //cm
const unsigned int MAX_SONAR_TIME = MAX_SONAR_DISTANCE * 2 * 10 / 343 + 1;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed with Matthias, an alternative solution consists in changing this line to:

const unsigned long MAX_SONAR_TIME = (long)(MAX_SONAR_DISTANCE * 2 * 10 / 343 + 1);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as discussed.

@thias15 thias15 merged commit 7b03f66 into master Apr 4, 2022
@thias15 thias15 deleted the thias15/esp32-firmware branch May 4, 2022 19:14
lacykaltgr pushed a commit to satinavrobotics/SatiBot that referenced this pull request Jun 1, 2025
Firmware support for RTR_520 with ESP32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants