Conversation
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - Andy
PyroAVR
left a comment
There was a problem hiding this comment.
This really should be a demo merge. We should discuss whether this is really "quality enough" for a merge into master, or if this is really a demo commit that needs cleanup before getting merged into master.
| .rx_pcr = &(PORTB->PCR[16]), | ||
| .tx_pcr = &(PORTB->PCR[17]), | ||
| .rx_pcr = &(PORTA->PCR[1]), | ||
| .tx_pcr = &(PORTA->PCR[2]), |
There was a problem hiding this comment.
I feel like we should have left these hunks out, and include them only on a demo branch, since during normal debugging we're going to want the multiplexed OpenSDA + UART streams.
| .ct_pcr = 0, | ||
| .rx_alt = 3, | ||
| .tx_alt = 3, | ||
| .rx_alt = 2, |
| .port_clock_gate_base = &(SIM->SCGC5), | ||
| .uart_clock_gate_mask = SIM_SCGC4_UART0_MASK, | ||
| .port_clock_gate_mask = SIM_SCGC5_PORTB_MASK, | ||
| .port_clock_gate_mask = SIM_SCGC5_PORTA_MASK, |
| */ | ||
| void servo_init_io() { | ||
| // Enable clock on PORT C | ||
| SIM -> SCGC5 |= SIM_SCGC5_PORTC_MASK; |
| // Timer Overflow Interrupt Enable | ||
| FTM3->SC = FTM_SC_PS(5) | FTM_SC_CLKS(1) | FTM_SC_TOIE_MASK; | ||
| } | ||
|
|
There was a problem hiding this comment.
Yeah, this definitely needs a refactor.
- the code here should have Sabrina's name on it, so we need to figure out how to fix that without merging this.
- it should be re-named as an FTM driver - the question is whether it is worthwhile for the time being, or will this be "good enough" and we can just fix it later if we ever get to it?
- It would be nice to at least make this able to use any FTM module, not just the ones specifically connected to the board.
src/algo/mahony.c
Outdated
| q3 += (qa * gz + qb * gy - qc * gx); | ||
|
|
||
| // Normalise quaternion | ||
| recipNorm = invSqrt(q0 * q0 + q1 * q1 + q2 * q2 + q3 * q3); |
There was a problem hiding this comment.
Why are we still using this?
| schedule_process(&process_table, &flight_ctrl_app); | ||
|
|
||
| return 0; | ||
| } |
There was a problem hiding this comment.
We need to rename this file, because there may be multiple "mains" that we want - configurations of many processes.
| pcb_t sensor_fusion_app; | ||
| uint32_t sensor_fusion_stack[SENSOR_FUSION_STACK_SIZE]; | ||
|
|
||
| int sensor_fusion_main(void) { |
There was a problem hiding this comment.
docs - I know what this does, but it would be nice to have it written down.
| bool i2c_free; | ||
|
|
||
| /* initialize the sensor offsets */ | ||
| goffx = GYRO_OFFSET_X; |
There was a problem hiding this comment.
We should document where these are obtained
| mz = (mz * MAG_SCALE) - moffz; | ||
|
|
||
| /* signal that data is ready */ | ||
| sensor_data_ready = true; |
There was a problem hiding this comment.
sensor data ends up being ready after the loop, but then is never set to not ready again. If this process is preempted before finishing a frame, it is erroneously signalling valid data.
Additionally, to ensure that another process uses this data frame before updating it again, a yield() should be placed at the end of this loop.
This is one ain't pretty.
Merges:
Work to be done: