- added shared.c file containing functions that can be accessed from both cores

- revised CV programming especially writing
- Core 1 is only started when valid package with correct address is received
- Extended addresses are now correctly verified and implemented
- Base PWM measurement is now done on core0 and checked for automatically in cv_setup_check()
- Moved Motor PWM, GPIO, ADC to core0
- Implemented inverted direction mode (CV_29) according to DCC-Standards
- Limited feed-forward parameters y_2 to max_output/y_1
- k_p gain slopes are now calculated on initialization
- k_p gain parameters are also in pid parameter struct now
- Revised init_pid()
- Implemented Packet timeout check (CV_11)
- 16Bit and 32Bit CVs now always have the highest bytes as the lowest array index to accommodate get_XXbit_CV() functions
This commit is contained in:
1nct committed 2022-08-01 17:20:05 +02:00
1 parent f09c4ff136
commit fd017ea685
8 files changed
+820 -601

No files matched your search

+11 -2
View File
@@ -5,10 +5,11 @@
//////////////////////////
#pragma once
#include <stdio.h>
#include "string.h"
#include "pico/float.h"
#include "pico/stdlib.h"
#include "pico/multicore.h"
#include "pico/printf.h"
#include "hardware/pwm.h"
#include "hardware/adc.h"
#include "hardware/flash.h"
@@ -30,7 +31,15 @@
//GPIO pin mask with allowed outputs (AUX & GPIO (configured as outputs))
#define GPIO_ALLOWED_OUTPUTS (GPIO_OUTPUT_MASK|AUX_PIN_MASK) & ~(GPIO_ILLEGAL_MASK)
#define FLASH_TARGET_OFFSET (PICO_FLASH_SIZE_BYTES-FLASH_SECTOR_SIZE) //This Offset should be far enough away from program data
extern repeating_timer_t pid_control_timer;
extern repeating_timer_t speed_helper_timer;
extern const uint8_t *CV_ARRAY_FLASH;
void core1_entry();
void core1_entry();
float measure(uint8_t total_iterations,
uint8_t measurement_delay_us,
uint8_t l_side_arr_cutoff,
uint8_t r_side_arr_cutoff,
bool direction);
uint32_t get_32bit_CV (uint16_t CV_start_index);
uint16_t get_16bit_CV (uint16_t CV_start_index);