Add CanDebugMenu

This commit is contained in:
2022-01-04 02:39:22 +01:00
parent 0c77d459a5
commit 914a1dc60c
8 changed files with 286 additions and 31 deletions

View File

@@ -6,8 +6,8 @@
#include <optional>
// esp-idf
#include <driver/gpio.h>
#include <driver/twai.h>
#include <driver/gpio.h>
#include <esp_log.h>
// 3rdparty lib includes
@@ -27,6 +27,8 @@ namespace can {
uint32_t can_total_error_cnt;
namespace {
constexpr const char * const TAG = "BOBBYCAN";
bool tryParseCanInput();
} // namespace
std::optional<int16_t> can_gas, can_brems;
@@ -77,6 +79,13 @@ void initCan()
}
}
void updateCan()
{
for (int i = 0; i < 4; i++)
if (!tryParseCanInput())
break;
}
namespace {
template<bool isBack>
@@ -189,7 +198,6 @@ bool parseBoardcomputerCanMessage(const twai_message_t &message)
return false;
}
} // namespace
bool tryParseCanInput()
{
@@ -249,12 +257,7 @@ bool tryParseCanInput()
return true;
}
void parseCanInput()
{
for (int i = 0; i < 4; i++)
if (!tryParseCanInput())
break;
}
} // namespace
void sendCanCommands()
{