auto-sync

This commit is contained in:
rusEfi 2016-02-04 21:03:01 -05:00
parent f71b639bbf
commit 62844ab261
6 changed files with 15 additions and 11 deletions

View File

@ -85,8 +85,8 @@ board_configuration_s *boardConfiguration = &persistentState.persistentConfigura
* CH_FREQUENCY is the number of system ticks in a second
*/
static VirtualTimer periodicSlowTimer;
static VirtualTimer periodicFastTimer;
static virtual_timer_t periodicSlowTimer;
static virtual_timer_t periodicFastTimer;
static LoggingWithStorage logger("Engine Controller");

View File

@ -117,8 +117,8 @@ extern virtual_timers_list_t vtlist;
extern bool main_loop_started;
int getVtSizeEstimate(void) {
VirtualTimer *first = vtlist.vt_next;
VirtualTimer *cur = first->vt_next;
virtual_timer_t *first = vtlist.vt_next;
virtual_timer_t *cur = first->vt_next;
int c = 0;
while (c++ < 20 && cur != first) {
cur = cur->vt_next;

View File

@ -79,9 +79,9 @@ static void setInjectorEnabled(int id, int value) {
static void runBench(brain_pin_e brainPin, OutputPin *output, float delayMs, float onTimeMs, float offTimeMs,
int count) {
int delaySt = (int) (delayMs * CH_FREQUENCY / 1000);
int onTimeSt = (int) (onTimeMs * CH_FREQUENCY / 1000);
int offTimeSt = (int) (offTimeMs * CH_FREQUENCY / 1000);
int delaySt = MS2ST(delayMs);
int onTimeSt = MS2ST(onTimeMs);
int offTimeSt = MS2ST(offTimeMs);
if (delaySt < 0) {
scheduleMsg(&logger, "Invalid delay %f", delayMs);
return;

View File

@ -60,6 +60,10 @@ typedef Thread thread_t;
typedef EventListener event_listener_t;
typedef EventSource event_source_t;
typedef VTList virtual_timers_list_t;
typedef VirtualTimer virtual_timer_t;
#define HAL_SUCCESS CH_SUCCESS
#define HAL_FAILED CH_FAILED
#define THD_WORKING_AREA WORKING_AREA
#define THD_FUNCTION(tname, arg) void tname(void *arg)

View File

@ -53,7 +53,7 @@ flashsector_t flashSectorAt(flashaddr_t address) {
static bool flashUnlock(void) {
/* Check if unlock is really needed */
if (!(FLASH->CR & FLASH_CR_LOCK))
return CH_SUCCESS;
return HAL_SUCCESS;
/* Write magic unlock sequence */
FLASH->KEYR = 0x45670123;
@ -61,8 +61,8 @@ static bool flashUnlock(void) {
/* Check if unlock was successful */
if (FLASH->CR & FLASH_CR_LOCK)
return CH_FAILED;
return CH_SUCCESS;
return HAL_FAILED;
return HAL_SUCCESS;
}
/**

View File

@ -14,7 +14,7 @@
/* Error codes */
/** @brief Flash operation successful */
#define FLASH_RETURN_SUCCESS CH_SUCCESS
#define FLASH_RETURN_SUCCESS HAL_SUCCESS
/** @brief Flash operation error because of denied access, corrupted memory.*/
#define FLASH_RETURN_NO_PERMISSION -1