Skip to content

Commit

Permalink
[CAN] Fix command decoder for CAN commands
Browse files Browse the repository at this point in the history
  • Loading branch information
TD-er committed Sep 22, 2024
1 parent 29f10cf commit 0bc2b45
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ docs/source/Plugin/_plugin_sets_overview.repl


.platformio/

*.Identifier
12 changes: 7 additions & 5 deletions src/_P174_CAN_helper.ino
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ void P174_check_timeout(EventStruct *event, int idx)
{
if (!(PCONFIG(3) & idx_flag))
{
String log_debug = F("Disconnected");
addLogMove(LOG_LEVEL_INFO, log_debug);
addLogMove(LOG_LEVEL_INFO, F("Disconnected"));
}
PCONFIG(3) |= idx_flag;
}
Expand Down Expand Up @@ -175,9 +174,12 @@ boolean Plugin_174(uint8_t function, struct EventStruct *event, String& string)

case PLUGIN_READ:
{
String log = "CAN Import :" + String(event->TaskIndex) + " got READ event with values: " +
String(event->Par1) + String(" ") + String(event->Par2);
addLogMove(LOG_LEVEL_DEBUG, log);

addLogMove(LOG_LEVEL_DEBUG, strformat(
F("CAN Import : %u got READ event with values: %d %d"),
event->TaskIndex,
event->Par1,
event->Par2));
if (event->Par1 == PCONFIG(0) && event->Par2 == PCONFIG(2))
{
const int16_t sensorTypeVal = static_cast<int16_t>(event->sensorType);
Expand Down
8 changes: 4 additions & 4 deletions src/src/Commands/InternalCommands_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ const char Internal_commands_s[] PROGMEM =
"sdcard|"
"sdremove|"
#endif // #if FEATURE_SD
#ifdef FEATURE_CAN
"sendcan|"
"sendtocan|"
#endif
#if FEATURE_ESPEASY_P2P
"sendto|"
#endif // #if FEATURE_ESPEASY_P2P
Expand Down Expand Up @@ -276,10 +280,6 @@ const char Internal_commands_w[] PROGMEM =
"wdconfig|"
"wdread|"
#endif // ifndef LIMIT_BUILD_SIZE
#ifdef FEUTER_CAN
"sendcan|"
"sendtocan|"
#endif
;

const char* getInternalCommand_Haystack_Offset(const char firstLetter, int& offset)
Expand Down
10 changes: 4 additions & 6 deletions src/src/Commands/InternalCommands_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ enum class ESPEasy_cmd_e : uint8_t {
sdcard,
sdremove,
#endif // #if FEATURE_SD
#ifdef FEATURE_CAN
sendcan,
sendtocan,
#endif
#if FEATURE_ESPEASY_P2P
sendto,
#endif // #if FEATURE_ESPEASY_P2P
Expand Down Expand Up @@ -232,12 +236,6 @@ enum class ESPEasy_cmd_e : uint8_t {
wdread,
#endif // ifndef LIMIT_BUILD_SIZE

#ifdef FEATURE_CAN
sendcan,
sendtocan,
#endif


NotMatched // Keep as last one
};

Expand Down
18 changes: 17 additions & 1 deletion src/src/CustomBuild/define_plugin_sets.h
Original file line number Diff line number Diff line change
Expand Up @@ -3419,10 +3419,26 @@ To create/register a plugin, you have to :
#endif
#endif

#ifdef FEATURE_CAN
#if FEATURE_CAN
#ifdef ESP8266
#undef FEATURE_CAN // Do not use CAN bus for ESP8266
#define FEATURE_CAN 0
#endif
#endif
#endif

#ifndef FEATURE_CAN
#define FEATURE_CAN 0
#endif

#if FEATURE_CAN
#ifndef USES_C022 // CAN Controller
#define USE_C022
#endif
#ifndef USES_P174
#define USES_P174 // CAN Import plugin
#endif
#endif

#if defined(DISABLE_NEOPIXEL_PLUGINS) && DISABLE_NEOPIXEL_PLUGINS
// Disable NeoPixel plugins
Expand Down

0 comments on commit 0bc2b45

Please sign in to comment.