Subversion Repositories EDIS_Ignition

Rev

Rev 16 | Rev 18 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16 Rev 17
Line 71... Line 71...
71
// compensated temperature
71
// compensated temperature
72
int32_t comp_temp = -10000;
72
int32_t comp_temp = -10000;
73
 
73
 
74
int32_t timing = 0;
74
int32_t timing = 0;
75
 
75
 
-
 
76
// 6 degrees error in timing wheel this time .. 
-
 
77
int const TIMING_OFFSET = -6 * TIMING_SCALE;
76
/* USER CODE END PV */
78
/* USER CODE END PV */
77
 
79
 
78
/* Private function prototypes -----------------------------------------------*/
80
/* Private function prototypes -----------------------------------------------*/
79
void SystemClock_Config(void);
81
void SystemClock_Config(void);
80
static void MX_GPIO_Init(void);
82
static void MX_GPIO_Init(void);
Line 199... Line 201...
199
 
201
 
200
 
202
 
201
  ResetRxBuffer(&uc2);
203
  ResetRxBuffer(&uc2);
202
 
204
 
203
  resetPLX();
205
  resetPLX();
-
 
206
 
204
  // HAL_IWDG_Init(&hiwdg);
207
  // HAL_IWDG_Init(&hiwdg);
205
  /* USER CODE END 2 */
208
  /* USER CODE END 2 */
206
 
209
 
207
  /* Infinite loop */
210
  /* Infinite loop */
208
  /* USER CODE BEGIN WHILE */
211
  /* USER CODE BEGIN WHILE */
Line 274... Line 277...
274
      if (rpm > 0)
277
      if (rpm > 0)
275
      {
278
      {
276
        cc_feed_rpm(rpm);
279
        cc_feed_rpm(rpm);
277
        // compute timing value, feed to display
280
        // compute timing value, feed to display
278
        timing = mapTiming(rpm, 1000 - comp_pres / 100);
281
        timing = mapTiming(rpm, 1000 - comp_pres / 100);
279
        cc_feed_timing(timing);
282
        cc_feed_timing(timing );
280
        int microsecs = mapTimingToMicroseconds(timing, 0);
283
        int microsecs = mapTimingToMicroseconds(timing + TIMING_OFFSET, 0);
281
        __HAL_TIM_SET_AUTORELOAD(&htim1, microsecs + SAW_DELAY);
284
        __HAL_TIM_SET_AUTORELOAD(&htim1, microsecs + SAW_DELAY);
282
      }
285
      }
283
    }
286
    }
284
 
287
 
285
   
288