mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-02-26 20:33:53 +01:00
remove old definition and afch
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
#include "lib.h"
|
||||
#include "ascii_cmd.h"
|
||||
|
||||
#define CMD_MATCHES(a) (strcmp(cmd, (char *)a) == 0)
|
||||
|
||||
typedef struct {
|
||||
const char *cmd;
|
||||
void (*handler)(char *arg, RDSModulator* mod, char* output);
|
||||
@@ -24,43 +22,6 @@ static void handle_ptyn(char *arg, RDSModulator* mod, char* output) {
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
static void handle_afch(char *arg, RDSModulator* mod, char* output) {
|
||||
if(arg[0] == '\0') {
|
||||
memset(&(mod->enc->data[mod->enc->program].af), 0, sizeof(mod->enc->data[mod->enc->program].af));
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&(mod->enc->data[mod->enc->program].af), 0, sizeof(mod->enc->data[mod->enc->program].af));
|
||||
uint8_t arg_count;
|
||||
RDSAFs new_af;
|
||||
uint8_t af[MAX_AFS], *af_iter;
|
||||
|
||||
arg_count = sscanf((char *)arg,
|
||||
"%hhx,%hhx,%hhx,%hhx,%hhx,"
|
||||
"%hhx,%hhx,%hhx,%hhx,%hhx,"
|
||||
"%hhx,%hhx,%hhx,%hhx,%hhx,"
|
||||
"%hhx,%hhx,%hhx,%hhx,%hhx,"
|
||||
"%hhx,%hhx,%hhx,%hhx,%hhx",
|
||||
&af[0], &af[1], &af[2], &af[3], &af[4],
|
||||
&af[5], &af[6], &af[7], &af[8], &af[9],
|
||||
&af[10], &af[11], &af[12], &af[13], &af[14],
|
||||
&af[15], &af[16], &af[17], &af[18], &af[19],
|
||||
&af[20], &af[21], &af[22], &af[23], &af[24]);
|
||||
|
||||
af_iter = af;
|
||||
memset(&new_af, 0, sizeof(RDSAFs));
|
||||
|
||||
while (arg_count-- != 0) {
|
||||
uint8_t current_value = *af_iter;
|
||||
float frequency = (875.0 + current_value) / 10.0;
|
||||
add_rds_af(&new_af, frequency);
|
||||
af_iter++;
|
||||
}
|
||||
|
||||
memcpy(&(mod->enc->data[mod->enc->program].af), &new_af, sizeof(mod->enc->data[mod->enc->program].af));
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
static void handle_tps(char *arg, RDSModulator* mod, char* output) {
|
||||
arg[PS_LENGTH * 2] = 0;
|
||||
set_rds_tps(mod->enc, xlat(arg));
|
||||
@@ -433,44 +394,6 @@ static void handle_eonaf(char *arg, char *pattern, RDSModulator* mod, char* outp
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
static void handle_eonafch(char *arg, char *pattern, RDSModulator* mod, char* output) {
|
||||
if (arg[0] == '\0') {
|
||||
memset(&(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af), 0, sizeof(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af));
|
||||
strcpy(output, "+\0");
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af), 0, sizeof(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af));
|
||||
uint8_t arg_count;
|
||||
RDSAFs new_af;
|
||||
uint8_t af[MAX_AFS], *af_iter;
|
||||
|
||||
arg_count = sscanf((char *)arg,
|
||||
"%hhx,%hhx,%hhx,%hhx,%hhx,"
|
||||
"%hhx,%hhx,%hhx,%hhx,%hhx,"
|
||||
"%hhx,%hhx,%hhx,%hhx,%hhx,"
|
||||
"%hhx,%hhx,%hhx,%hhx,%hhx,"
|
||||
"%hhx,%hhx,%hhx,%hhx,%hhx",
|
||||
&af[0], &af[1], &af[2], &af[3], &af[4],
|
||||
&af[5], &af[6], &af[7], &af[8], &af[9],
|
||||
&af[10], &af[11], &af[12], &af[13], &af[14],
|
||||
&af[15], &af[16], &af[17], &af[18], &af[19],
|
||||
&af[20], &af[21], &af[22], &af[23], &af[24]);
|
||||
|
||||
af_iter = af;
|
||||
memset(&new_af, 0, sizeof(RDSAFs));
|
||||
|
||||
while (arg_count-- != 0) {
|
||||
uint8_t current_value = *af_iter;
|
||||
float frequency = (875.0 + current_value) / 10.0;
|
||||
add_rds_af(&new_af, frequency);
|
||||
af_iter++;
|
||||
}
|
||||
|
||||
memcpy(&(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af), &new_af, sizeof(mod->enc->data[mod->enc->program].eon[atoi(pattern)-1].af));
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
static const command_handler_t commands_eq3[] = {
|
||||
{"PS", handle_ps, 2},
|
||||
{"PI", handle_pi, 2},
|
||||
@@ -493,7 +416,6 @@ static const command_handler_t commands_eq4[] = {
|
||||
static const command_handler_t commands_eq5[] = {
|
||||
{"TEXT", handle_rt1, 4},
|
||||
{"PTYN", handle_ptyn, 4},
|
||||
{"AFCH", handle_afch, 4},
|
||||
{"DPTY", handle_dpty, 4},
|
||||
};
|
||||
|
||||
@@ -536,7 +458,6 @@ static const pattern_command_handler_t pattern_commands[] = {
|
||||
{"EON", "TA", handle_eonta},
|
||||
{"EON", "TP", handle_eontp},
|
||||
{"EON", "AF", handle_eonaf},
|
||||
{"EON", "AFCH", handle_eonafch},
|
||||
{"PSN", "", handle_psn},
|
||||
{"DSN", "", handle_dsn},
|
||||
{"UDG", "", handle_udg},
|
||||
|
||||
Reference in New Issue
Block a user