Beast send support.
This commit is contained in:
20
common.c
20
common.c
@@ -83,11 +83,11 @@ char *packet_type_names[] = {
|
||||
};
|
||||
|
||||
|
||||
uint64_t mlat_timestamp_scale_mhz_in(uint64_t timestamp, uint32_t mhz) {
|
||||
static uint64_t mlat_timestamp_scale_mhz_in(uint64_t timestamp, uint32_t mhz) {
|
||||
return timestamp * (MLAT_MHZ / mhz);
|
||||
}
|
||||
|
||||
uint64_t mlat_timestamp_scale_width_in(uint64_t timestamp, uint64_t max, struct mlat_state *state) {
|
||||
static uint64_t mlat_timestamp_scale_width_in(uint64_t timestamp, uint64_t max, struct mlat_state *state) {
|
||||
if (timestamp < state->timestamp_last) {
|
||||
// Counter reset
|
||||
state->timestamp_generation += max;
|
||||
@@ -101,11 +101,27 @@ uint64_t mlat_timestamp_scale_in(uint64_t timestamp, uint64_t max, uint16_t mhz,
|
||||
return mlat_timestamp_scale_mhz_in(mlat_timestamp_scale_width_in(timestamp, max, state), mhz);
|
||||
}
|
||||
|
||||
static uint64_t mlat_timestamp_scale_mhz_out(uint64_t timestamp, uint64_t mhz) {
|
||||
return timestamp / (MLAT_MHZ / mhz);
|
||||
}
|
||||
|
||||
static uint64_t mlat_timestamp_scale_width_out(uint64_t timestamp, uint64_t max) {
|
||||
return timestamp % max;
|
||||
}
|
||||
|
||||
uint64_t mlat_timestamp_scale_out(uint64_t timestamp, uint64_t max, uint16_t mhz) {
|
||||
return mlat_timestamp_scale_width_out(mlat_timestamp_scale_mhz_out(timestamp, mhz), max);
|
||||
}
|
||||
|
||||
|
||||
uint32_t rssi_scale_in(uint32_t value, uint32_t max) {
|
||||
return value * (RSSI_MAX / max);
|
||||
}
|
||||
|
||||
uint32_t rssi_scale_out(uint32_t value, uint32_t max) {
|
||||
return value / (RSSI_MAX / max);
|
||||
}
|
||||
|
||||
|
||||
static uint8_t hex_table[256] = {0};
|
||||
static char hex_char_table[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', };
|
||||
|
||||
Reference in New Issue
Block a user