Skip to content
Snippets Groups Projects
Commit bc02b2c7 authored by nrs1g15's avatar nrs1g15
Browse files

Added peto tube stuff

parent da43b4ee
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "buffer.h" #include "buffer.h"
#include <mcp_can.h> #include <mcp_can.h>
#include <mcp_can_dfs.h> #include <mcp_can_dfs.h>
#include "evoScann-p.h"
#include "ecuCan.h" #include "ecuCan.h"
...@@ -187,6 +188,9 @@ void canParseRxMsg(CanMsgTemplate *canMsg) ...@@ -187,6 +188,9 @@ void canParseRxMsg(CanMsgTemplate *canMsg)
// This removes the need for a long if statement giving significant performance boosts // This removes the need for a long if statement giving significant performance boosts
(*ecuCanFuncPtrs[canMsg->idByte[0]])(canMsg); (*ecuCanFuncPtrs[canMsg->idByte[0]])(canMsg);
} }
else if (canMsg->id == 0x487) {
evoScannNonMux(canMsg);
}
} }
void canProcessRx() void canProcessRx()
......
...@@ -5,19 +5,11 @@ ...@@ -5,19 +5,11 @@
#include "daq.h" #include "daq.h"
#include "sd.h" #include "sd.h"
struct DaqEcuFormat
{
uint8_t startTag;
uint32_t timestamp;
uint16_t data;
uint8_t endTag;
};
/* /*
* e.g 1 is rpm and 2 is tps... etc * e.g 1 is rpm and 2 is tps... etc
*/ */
const uint8_t daqEcuDataToTag[8][4] = { static const uint8_t daqEcuDataToTag[8][4] = {
{1, 2, 3, 4}, {1, 2, 3, 4},
{5, 6, 7, 8}, {5, 6, 7, 8},
{9, 10, 11, 12}, {9, 10, 11, 12},
...@@ -25,7 +17,7 @@ const uint8_t daqEcuDataToTag[8][4] = { ...@@ -25,7 +17,7 @@ const uint8_t daqEcuDataToTag[8][4] = {
{17, 18, 19, 20}, {17, 18, 19, 20},
{21, 22, 23, 24}, {21, 22, 23, 24},
{25, 26, 27, 28}, {25, 26, 27, 28},
{29, 30, 31, 32} {29, 30, 31, 32},
}; };
void daqEcuWrite(CanMsgTemplate *canMsg, uint8_t index) void daqEcuWrite(CanMsgTemplate *canMsg, uint8_t index)
......
...@@ -7,6 +7,22 @@ ...@@ -7,6 +7,22 @@
#include "can.h" #include "can.h"
struct DaqEcuFormat
{
uint8_t startTag;
uint32_t timestamp;
uint16_t data;
uint8_t endTag;
};
struct DaqEvoScannPressureFormat
{
uint8_t startTag;
uint32_t timestamp;
uint32_t data;
uint8_t endTag;
};
void daqEcuWrite(CanMsgTemplate *canMsg, uint8_t index); void daqEcuWrite(CanMsgTemplate *canMsg, uint8_t index);
#endif //DAQ_H #endif //DAQ_H
//
// Created by Sil on 27/07/2019.
//
#include "evoScann-p.h"
void evoScannMux0(CanMsgTemplate *canMsg);
void evoScannMux1(CanMsgTemplate *canMsg);
void evoScannMux2(CanMsgTemplate *canMsg);
void (*evoScannFunc_ptrs[3])(CanMsgTemplate *) = {evoScannMux0, evoScannMux1, evoScannMux2};
void evoScannMux0(CanMsgTemplate *canMsg)
{
#if EVO_SCANN_SEN_1_ENABLED
uint16_t sen1Raw = (canMsg->data[1] << 8) | canMsg->data[2];
int sen1 = (sen1Raw + 60000);
// Serial.print("S1 ");
// Serial.println(sen1);
#endif // EVO_SCANN_SEN_1_ENABLED
#if EVO_SCANN_SEN_2_ENABLED
uint16_t sen2Raw = (canMsg->data[3] << 8) | canMsg->data[4];
int sen2 = (sen2Raw + 60000);
// Serial.print("S2 ");
// Serial.println(sen2);
#endif // EVO_SCANN_SEN_2_ENABLED
#if EVO_SCANN_SEN_3_ENABLED
uint16_t sen3Raw = (canMsg->data[5] << 8) | canMsg->data[6];
int sen3 = (sen3Raw + 60000);
// Serial.print("S3 ");
// Serial.println(sen3);
#endif // EVO_SCANN_SEN_3_ENABLED
// Serial.print("R ");
// Serial.println(canMsg->data[7]);
}
void evoScannMux1(CanMsgTemplate *canMsg)
{
#if EVO_SCANN_SEN_4_ENABLED
uint16_t sen4Raw = (canMsg->data[1] << 8) | canMsg->data[2];
int sen4 = (sen4Raw + 60000);
// Serial.print("S4 ");
// Serial.println(sen4);
#endif // EVO_SCANN_SEN_4_ENABLED
#if EVO_SCANN_SEN_5_ENABLED
uint16_t sen5Raw = (canMsg->data[3] << 8) | canMsg->data[4];
int sen5 = (sen5Raw + 60000);
// Serial.print("S5 ");
// Serial.println(sen5);
#endif // EVO_SCANN_SEN_5_ENABLED
#if EVO_SCANN_SEN_6_ENABLED
uint16_t sen6Raw = (canMsg->data[5] << 8) | canMsg->data[6];
int sen6 = (sen6Raw + 60000);
// Serial.print("S6 ");
// Serial.println(sen6);
#endif // EVO_SCANN_SEN_6_ENABLED
// Serial.print("T ");
// Serial.println(canMsg->data[7]);
}
void evoScannMux2(CanMsgTemplate *canMsg)
{
#if EVO_SCANN_SEN_7_ENABLED
uint16_t sen7Raw = (canMsg->data[1] << 8) | canMsg->data[2];
int sen7 = (sen7Raw + 60000);
// Serial.print("S7 ");
// Serial.println(sen7);
#endif // EVO_SCANN_SEN_7_ENABLED
#if EVO_SCANN_SEN_8_ENABLED
uint16_t sen8Raw = (canMsg->data[3] << 8) | canMsg->data[4];
int sen8 = (sen8Raw + 60000);
// Serial.print("S8 ");
// Serial.println(sen8);
#endif // EVO_SCANN_SEN_8_ENABLED
}
void evoScannNonMux(CanMsgTemplate *canMsg)
{
(*evoScannFunc_ptrs[canMsg->data[0]])(canMsg);
}
\ No newline at end of file
//
// Created by Sil on 27/07/2019.
//
#ifndef EVOSCANN_P_H
#define EVOSCANN_P_H
#include "can.h"
#define DEBUG_EVO_SCANN 1
#define EVO_SCANN_SEN_1_ENABLED 1
#define EVO_SCANN_SEN_2_ENABLED 1
#define EVO_SCANN_SEN_3_ENABLED 0
#define EVO_SCANN_SEN_4_ENABLED 0
#define EVO_SCANN_SEN_5_ENABLED 0
#define EVO_SCANN_SEN_6_ENABLED 0
#define EVO_SCANN_SEN_7_ENABLED 0
#define EVO_SCANN_SEN_8_ENABLED 0
void evoScannNonMux(CanMsgTemplate *canMsg);
#endif //EVOSCANN_P_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment