diff --git a/afsk/main.c b/afsk/main.c index 4f140127..4142623f 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -132,8 +132,8 @@ void write_to_buffer(int i, int symbol, int val); void write_wave(int i, short int * buffer); int uart_fd; -int reset_count; -float uptime_sec; +int reset_count = 0; +float uptime_sec = 0; long int uptime; char call[5]; char sim_yes[10]; @@ -1751,16 +1751,13 @@ void get_tlm_fox() { //printf("Sleep over\n"); h[0] = (short int) ((h[0] & 0xf8) | (id & 0x07)); // 3 bits - // printf("h[0] %x\n", h[0]); - 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); - // printf("h[1] %x\n", h[1]); - if (uptime != 0) // if uptime is 0, leave reset count at 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[1] = (short int) ((reset_count >> 5) & 0xff); 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)); - // printf("h[2] %x\n", h[2]); h[3] = (short int) ((uptime >> 5) & 0xff); h[4] = (short int) ((uptime >> 13) & 0xff); h[5] = (short int) ((h[5] & 0xf0) | ((uptime >> 21) & 0x0f));