mirror of
https://github.com/xdsopl/robot36.git
synced 2026-01-07 08:49:56 +01:00
added "gray" area between data and control signal to improve sync detection
This commit is contained in:
parent
9446d5976e
commit
32efb41613
|
|
@ -20,12 +20,11 @@ limitations under the License.
|
|||
#include "constants.rsh"
|
||||
#include "state.rsh"
|
||||
|
||||
static int calibration_detected(float dat_value, int cnt_active, int cnt_quantized)
|
||||
static int calibration_detected(float dat_value, int dat_active, int cnt_active, int cnt_quantized)
|
||||
{
|
||||
static int progress, countdown;
|
||||
static int leader_counter, break_counter;
|
||||
|
||||
int dat_active = !cnt_active;
|
||||
progress = countdown ? progress : 0;
|
||||
countdown -= !!countdown;
|
||||
|
||||
|
|
@ -99,9 +98,9 @@ static int calibration_detected(float dat_value, int cnt_active, int cnt_quantiz
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int calibration_detector(float dat_value, int cnt_active, int cnt_quantized)
|
||||
static int calibration_detector(float dat_value, int dat_active, int cnt_active, int cnt_quantized)
|
||||
{
|
||||
switch (calibration_detected(dat_value, cnt_active, cnt_quantized)) {
|
||||
switch (calibration_detected(dat_value, dat_active, cnt_active, cnt_quantized)) {
|
||||
case 0x88:
|
||||
return mode_robot36;
|
||||
case 0x0c:
|
||||
|
|
|
|||
|
|
@ -130,10 +130,11 @@ void decode(int samples) {
|
|||
float cnt_value = demodulate(&cnt_fmd, cnt_baseband);
|
||||
float dat_value = demodulate(&dat_fmd, dat_baseband);
|
||||
|
||||
int cnt_active = cabs(dat_baseband) < cabs(cnt_baseband);
|
||||
uchar cnt_level = save_cnt ? 127.5f - 127.5f * cnt_value : 0.0f;
|
||||
uchar dat_level = save_dat ? 127.5f + 127.5f * dat_value : 0.0f;
|
||||
value_buffer[hpos + even_hpos] = cnt_active ? cnt_level : dat_level;
|
||||
int cnt_active = cabs(dat_baseband) < 4.0f * cabs(cnt_baseband);
|
||||
int dat_active = cabs(cnt_baseband) < 4.0f * cabs(dat_baseband);
|
||||
uchar cnt_level = save_cnt && cnt_active ? 127.5f - 127.5f * cnt_value : 0.0f;
|
||||
uchar dat_level = save_dat && dat_active ? 127.5f + 127.5f * dat_value : 0.0f;
|
||||
value_buffer[hpos + even_hpos] = cnt_level | dat_level;
|
||||
|
||||
int cnt_quantized = round(cnt_value);
|
||||
int dat_quantized = round(dat_value);
|
||||
|
|
@ -143,7 +144,7 @@ void decode(int samples) {
|
|||
sync_counter = sync_level ? sync_counter + 1 : 0;
|
||||
|
||||
if (*current_mode != mode_raw) {
|
||||
int detected_mode = calibration_detector(dat_value, cnt_active, cnt_quantized);
|
||||
int detected_mode = calibration_detector(dat_value, dat_active, cnt_active, cnt_quantized);
|
||||
if (detected_mode >= 0)
|
||||
reset();
|
||||
switch_mode(detected_mode);
|
||||
|
|
|
|||
Loading…
Reference in a new issue