auto-sync
This commit is contained in:
parent
02f530df84
commit
8863f8127f
|
@ -31,6 +31,11 @@
|
||||||
#define EFI_ENABLE_ASSERTS TRUE
|
#define EFI_ENABLE_ASSERTS TRUE
|
||||||
#endif /* EFI_ENABLE_ASSERTS */
|
#endif /* EFI_ENABLE_ASSERTS */
|
||||||
|
|
||||||
|
#if !defined(EFI_ENABLE_MOCK_ADC) || defined(__DOXYGEN__)
|
||||||
|
#define EFI_ENABLE_MOCK_ADC TRUE
|
||||||
|
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||||
|
|
||||||
|
|
||||||
//#define EFI_UART_ECHO_TEST_MODE TRUE
|
//#define EFI_UART_ECHO_TEST_MODE TRUE
|
||||||
|
|
||||||
#define EFI_USE_UART_FOR_CONSOLE FALSE
|
#define EFI_USE_UART_FOR_CONSOLE FALSE
|
||||||
|
|
|
@ -26,6 +26,21 @@
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "engine_sniffer.h"
|
#include "engine_sniffer.h"
|
||||||
|
#include "adc_math.h"
|
||||||
|
|
||||||
|
MockAdcState::MockAdcState() {
|
||||||
|
memset(hasMockAdc, 0, sizeof(hasMockAdc));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MockAdcState::setMockVoltage(int hwChannel, float voltage) {
|
||||||
|
fakeAdcValues[hwChannel] = voltsToAdc(voltage);
|
||||||
|
hasMockAdc[hwChannel] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MockAdcState::getMockAdcValue(int hwChannel) {
|
||||||
|
return fakeAdcValues[hwChannel];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,19 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
|
#define MOCK_ADC_SIZE 16
|
||||||
|
|
||||||
|
class MockAdcState {
|
||||||
|
public:
|
||||||
|
MockAdcState();
|
||||||
|
bool hasMockAdc[MOCK_ADC_SIZE];
|
||||||
|
int fakeAdcValues[MOCK_ADC_SIZE];
|
||||||
|
|
||||||
|
void setMockVoltage(int hwChannel, float voltage);
|
||||||
|
int getMockAdcValue(int hwChannel);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
||||||
#include "datalogging.h"
|
#include "datalogging.h"
|
||||||
|
|
||||||
|
|
|
@ -9,19 +9,20 @@
|
||||||
#include "boards.h"
|
#include "boards.h"
|
||||||
#include "engine_configuration.h"
|
#include "engine_configuration.h"
|
||||||
#include "adc_math.h"
|
#include "adc_math.h"
|
||||||
|
#include "engine_sniffer.h"
|
||||||
|
|
||||||
static LoggingWithStorage logger("simulator board");
|
static LoggingWithStorage logger("simulator board");
|
||||||
extern engine_configuration_s *engineConfiguration;
|
extern engine_configuration_s *engineConfiguration;
|
||||||
|
|
||||||
static float fakeAdcValues[16];
|
MockAdcState mockAdcState;
|
||||||
|
|
||||||
int getAdcValue(const char *msg, int hwChannel) {
|
int getAdcValue(const char *msg, int hwChannel) {
|
||||||
return fakeAdcValues[hwChannel];
|
return mockAdcState.getMockAdcValue(hwChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setVoltage(int hwChannel, float voltage) {
|
static void setVoltage(int hwChannel, float voltage) {
|
||||||
scheduleMsg(&logger, "fake voltage: channel %d value %f", hwChannel, voltage);
|
scheduleMsg(&logger, "fake voltage: channel %d value %f", hwChannel, voltage);
|
||||||
fakeAdcValues[hwChannel] = voltsToAdc(voltage);
|
mockAdcState.setMockVoltage(hwChannel, voltage);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setCltVoltage(float voltage) {
|
static void setCltVoltage(float voltage) {
|
||||||
|
|
Loading…
Reference in New Issue