refactoring

This commit is contained in:
rusefi 2018-09-16 22:00:14 -04:00
parent f09579baf0
commit 7caf762609
17 changed files with 103 additions and 134 deletions

View File

@ -4,7 +4,6 @@
* @date Dec 29, 2012
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#pragma once
#ifndef CONSOLE_IO_H_
#define CONSOLE_IO_H_

View File

@ -6,7 +6,6 @@
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#pragma once
#ifndef RFICONSOLE_H_
#define RFICONSOLE_H_

View File

@ -9,11 +9,8 @@
#ifndef ENGINE_CONFIGURATION_H_
#define ENGINE_CONFIGURATION_H_
#include "efifeatures.h"
#include "crc.h"
#include "rusefi_enums.h"
#include "global.h"
#include "rusefi_types.h"
#include "crc.h"
#include "engine_configuration_generated_structures.h"
#define CLT_MANUAL_IDLE_CORRECTION config->cltIdleCorrBins, config->cltIdleCorr, CLT_CURVE_SIZE

View File

@ -9,16 +9,10 @@
#ifndef SIGNAL_EXECUTOR_H_
#define SIGNAL_EXECUTOR_H_
#include "rusefi_enums.h"
#include "global.h"
#include "efifeatures.h"
#include "scheduler.h"
#include "efiGpio.h"
#if EFI_PROD_CODE
#include "datalogging.h"
#endif /* EFI_PROD_CODE */
#if EFI_SIGNAL_EXECUTOR_SLEEP
#include "signal_executor_sleep.h"
#endif /* EFI_SIGNAL_EXECUTOR_SLEEP */

View File

@ -10,7 +10,7 @@
#ifndef ALTERNATORCONTROLLER_H_
#define ALTERNATORCONTROLLER_H_
#include "main.h"
#include "global.h"
void initAlternatorCtrl(Logging *sharedLogger);
void setAltPFactor(float p);
void setAltIFactor(float p);

View File

@ -25,8 +25,6 @@
#if EFI_INTERNAL_FLASH || defined(__DOXYGEN__)
#include "engine_controller.h"
#include "datalogging.h"
#include "engine.h"
static bool needToWriteConfiguration = false;

View File

@ -10,10 +10,9 @@
#ifndef MAIN_LOOP_H_
#define MAIN_LOOP_H_
#include "main.h"
#include "engine.h"
#include "event_registry.h"
#include "engine.h"
void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECLARE_ENGINE_PARAMETER_SUFFIX);

View File

@ -2,6 +2,7 @@
#include "main.h"
#include "engine_configuration.h"
#include "max31855.h"
#include "rusefi.h"
egt_cs_array_t max31855_cs;

View File

@ -18,6 +18,8 @@ extern "C"
#include <ch.h>
#include <hal.h>
#include <math.h>
#include <float.h>
#include <string.h>
#ifndef DEFAULT_ENGINE_TYPE
@ -44,6 +46,9 @@ typedef unsigned int time_t;
#include "obd_error_codes.h"
#include "error_handling.h"
#include "efitime.h"
#include "efilib.h"
/* definition to expand macro then apply to pragma message */
#define VALUE_TO_STRING(x) #x
#define VALUE(x) VALUE_TO_STRING(x)
@ -138,8 +143,50 @@ typedef unsigned int time_t;
*/
int getRemainingStack(thread_t *otp);
#ifdef __cplusplus
#include "cli_registry.h"
#include "datalogging.h"
#include "loggingcentral.h"
#include "eficonsole.h"
#endif /* __cplusplus */
#include "chprintf.h"
#ifdef __cplusplus
}
#endif /* __cplusplus */
// todo: access some existing configuration field
#define CORE_CLOCK 168000000
// 168 ticks in microsecond
#define US_TO_NT_MULTIPLIER 168
/**
* converts efitimeus_t to efitick_t
*/
#define US2NT(us) (((efitime_t)(us))*US_TO_NT_MULTIPLIER)
/**
* converts efitick_t to efitimeus_t
*/
#define NT2US(nt) ((nt) / US_TO_NT_MULTIPLIER)
#define Delay(ms) chThdSleepMilliseconds(ms)
#ifdef __cplusplus
extern "C"
{
#endif
bool lockAnyContext(void);
void unlockAnyContext(void);
#ifdef __cplusplus
}
#endif
#endif /* GLOBAL_H_ */

View File

@ -7,7 +7,7 @@
* http://rusefi.com/
*/
#include "main.h"
#include "global.h"
#include "rusefi.h"
#include "mpu_util.h"

View File

@ -4,69 +4,5 @@
* @date Nov 29, 2012
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#pragma once
#ifndef MAIN_H_
#define MAIN_H_
#include <math.h>
#include <float.h>
#include "efilib.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include "global.h"
#include "rusefi.h"
#include "efifeatures.h"
#include "efitime.h"
#include "rusefi_enums.h"
#ifdef __cplusplus
#include "cli_registry.h"
#include "datalogging.h"
#include "loggingcentral.h"
#include "eficonsole.h"
#endif /* __cplusplus */
#include "chprintf.h"
#ifdef __cplusplus
}
#endif /* __cplusplus */
// todo: access some existing configuration field
#define CORE_CLOCK 168000000
// 168 ticks in microsecond
#define US_TO_NT_MULTIPLIER 168
/**
* converts efitimeus_t to efitick_t
*/
#define US2NT(us) (((efitime_t)(us))*US_TO_NT_MULTIPLIER)
/**
* converts efitick_t to efitimeus_t
*/
#define NT2US(nt) ((nt) / US_TO_NT_MULTIPLIER)
#define Delay(ms) chThdSleepMilliseconds(ms)
#ifdef __cplusplus
extern "C"
{
#endif
int systicks2ms(int systicks);
bool lockAnyContext(void);
void unlockAnyContext(void);
#ifdef __cplusplus
}
#endif
#endif /* MAIN_H_ */

View File

@ -9,7 +9,6 @@
#ifndef RFICONSOLE_LOGIC_H_
#define RFICONSOLE_LOGIC_H_
#include "efifeatures.h"
#include "datalogging.h"
#include "rusefi_types.h"

View File

@ -9,8 +9,8 @@
#ifndef DATALOGGING_H_
#define DATALOGGING_H_
#include "global.h"
#include <stdarg.h>
#include <stdint.h>
#define DELIMETER ","

View File

@ -1,10 +1,3 @@
#include "global.h"
#ifdef __cplusplus
#include "chprintf.h"
#include "cli_registry.h"
#include "datalogging.h"
#include "eficonsole.h"
#include "loggingcentral.h"
#endif /* __cplusplus */

View File

@ -32,6 +32,14 @@
#include "rusefi_enums.h"
#include "obd_error_codes.h"
#ifdef __cplusplus
#include "chprintf.h"
#include "cli_registry.h"
#include "datalogging.h"
#include "eficonsole.h"
#include "loggingcentral.h"
#endif /* __cplusplus */
#define EFI_UNIT_TEST FALSE
#define hasFatalError() (FALSE)
@ -80,7 +88,7 @@ extern "C"
#endif /* __cplusplus */
void printToWin32Console(char *p);
int systicks2ms(int systicks);
int getRemainingStack(thread_t *otp);
// todo: move somewhere else?
@ -117,3 +125,5 @@ void applyNewConfiguration(void);
#define TRIGGER_SHAPE(x) engine->triggerCentral.triggerShape.x
#endif /* GLOBAL_H_ */

View File

@ -19,6 +19,45 @@
#include "efitime.h"
#include "auto_generated_enums.h"
#include <stdio.h>
#include <math.h>
#include "efitime.h"
#include "error_handling.h"
#include "efifeatures.h"
#include "efilib.h"
#include "efitime.h"
#include "boards.h"
#ifdef __cplusplus
#include "datalogging.h"
#include "loggingcentral.h"
extern "C"
{
#endif
#define CH_FREQUENCY 1000
typedef int bool_t;
typedef uint32_t systime_t;
void chDbgAssert(int c, char *msg, void *arg);
void print(const char *fmt, ...);
#define TICKS_IN_MS 100
#define chDbgCheck(x, y) chDbgAssert(x, y, NULL)
#ifdef __cplusplus
}
#endif
#define US_TO_NT_MULTIPLIER 100
#define ALWAYS_INLINE INLINE

View File

@ -6,48 +6,6 @@
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef MAIN_H_
#define MAIN_H_
#include <stdio.h>
#include <math.h>
#include "efitime.h"
#include "global.h"
#include "error_handling.h"
#include "efifeatures.h"
#include "efilib.h"
#include "efitime.h"
#include "boards.h"
#ifdef __cplusplus
#include "datalogging.h"
#include "loggingcentral.h"
extern "C"
{
#endif
#define CH_FREQUENCY 1000
typedef int bool_t;
typedef uint32_t systime_t;
void chDbgAssert(int c, char *msg, void *arg);
void print(const char *fmt, ...);
#define TICKS_IN_MS 100
#define chDbgCheck(x, y) chDbgAssert(x, y, NULL)
#define systicks2ms(x) (0)
#ifdef __cplusplus
}
#endif
#endif /* MAIN_H_ */