Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop interrupt handlers from corrupting xfire telemetry #40

Closed

Conversation

Projects
None yet
2 participants
@nrw505
Copy link

commented Oct 19, 2018

USART IRQ handlers write into TelemetryTx.SportTx, which
overwrites the data that the BASIC interpreter just wrote
into TelemetryTx.XfireTx, as TelemetryTx is a union that overlaps
SportTx and XfireTx.

To stop the Xfire send buffer getting zeroes written over it, separate
TelemetryTx.SportTx and TelemetryTx.XfireTx into SportTelemetryTx and
XFireTelemetryTx so they don't overlap anymore.

Stop interrupt handlers from corrupting xfire telemetry
USART IRQ handlers write into TelemetryTx.SportTx, which
overwrites the data that the BASIC interpreter just wrote
into TelemetryTx.XfireTx, as TelemetryTx is a union that overlaps
SportTx and XfireTx.

To stop the Xfire send buffer getting zeroes written over it, separate
TelemetryTx.SportTx and TelemetryTx.XfireTx into SportTelemetryTx and
XFireTelemetryTx so they don't overlap anymore.
@nrw505

This comment has been minimized.

Copy link
Author

commented Oct 19, 2018

While there are some indentation changes here they're just changing 2-spaces to tab characters

@MikeBland

This comment has been minimized.

Copy link
Owner

commented Oct 19, 2018

OK, to save on RAM usage, which is why there is a union in the first place (The SKY board only has 48K RAM and I'm trying to leave as much as possible for scripts), I'll implement a change to the union as:

struct t_SportTx
{
uint8_t *ptr ;
uint8_t index ;
uint8_t data[16] ;
} ;

struct t_XfireTx
{
uint16_t count ;
uint8_t command ;
uint8_t data[64] ;
} ;

struct t_telemetryTx
{
uint16_t sportCount ;
uint8_t sportBusy ;
union
{
struct t_SportTx SportTx ;
struct t_XfireTx XfireTx ;
} ;
} ;

This puts the 2 variables (now sportCount and sportBusy) in unique locations.

Mike

@nrw505

This comment has been minimized.

Copy link
Author

commented Oct 19, 2018

Fixed by 6bfb3fd

@nrw505 nrw505 closed this Oct 19, 2018

@nrw505 nrw505 deleted the nrw505:fix-corrupted-xfire-telemetry branch Oct 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.