fixed reset count 0 if uptime 0

pull/104/head
alanbjohnston 5 years ago committed by GitHub
parent 8752822a3e
commit ff5d55c4f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -132,8 +132,8 @@ void write_to_buffer(int i, int symbol, int val);
void write_wave(int i, short int * buffer); void write_wave(int i, short int * buffer);
int uart_fd; int uart_fd;
int reset_count; int reset_count = 0;
float uptime_sec; float uptime_sec = 0;
long int uptime; long int uptime;
char call[5]; char call[5];
char sim_yes[10]; char sim_yes[10];
@ -1751,16 +1751,13 @@ void get_tlm_fox() {
//printf("Sleep over\n"); //printf("Sleep over\n");
h[0] = (short int) ((h[0] & 0xf8) | (id & 0x07)); // 3 bits h[0] = (short int) ((h[0] & 0xf8) | (id & 0x07)); // 3 bits
// printf("h[0] %x\n", h[0]); if (uptime != 0) // if uptime is 0, leave reset count at 0
{
h[0] = (short int) ((h[0] & 0x07) | ((reset_count & 0x1f) << 3)); h[0] = (short int) ((h[0] & 0x07) | ((reset_count & 0x1f) << 3));
// printf("h[0] %x\n", h[0]);
h[1] = (short int) ((reset_count >> 5) & 0xff); h[1] = (short int) ((reset_count >> 5) & 0xff);
// printf("h[1] %x\n", h[1]);
if (uptime != 0) // if uptime is 0, leave reset count at 0
h[2] = (short int) ((h[2] & 0xf8) | ((reset_count >> 13) & 0x07)); h[2] = (short int) ((h[2] & 0xf8) | ((reset_count >> 13) & 0x07));
// printf("h[2] %x\n", h[2]); }
h[2] = (short int) ((h[2] & 0x0e) | ((uptime & 0x1f) << 3)); h[2] = (short int) ((h[2] & 0x0e) | ((uptime & 0x1f) << 3));
// printf("h[2] %x\n", h[2]);
h[3] = (short int) ((uptime >> 5) & 0xff); h[3] = (short int) ((uptime >> 5) & 0xff);
h[4] = (short int) ((uptime >> 13) & 0xff); h[4] = (short int) ((uptime >> 13) & 0xff);
h[5] = (short int) ((h[5] & 0xf0) | ((uptime >> 21) & 0x0f)); h[5] = (short int) ((h[5] & 0xf0) | ((uptime >> 21) & 0x0f));

Loading…
Cancel
Save

Powered by TurnKey Linux.