This commit is contained in:
Gerolf Ziegenhain 2016-10-05 18:50:41 +02:00
parent 95365cf6c1
commit 1a648e1cff
3 changed files with 11 additions and 4 deletions

View File

@ -97,10 +97,15 @@ int prepare_text2morse (int wpm)
return 0;
}
int char2morse(char c)
int char2morse(void)
{
char c='c', d;
// why? because!!!
// http://stackoverflow.com/questions/1352587/convert-a-string-into-morse-code/1355594^
for(;c= c?c:(c=toupper(getchar())-32)?c<0?1:"\x95#\x8CKa`^ZRBCEIQiw#S#nx(37+$6-2&@/4)'18=,*%.:0;?5" [c-12]-34:-3;c/=2)putchar(c/2?46-c%2:32);
for(;c= c?c:(c=toupper(getchar())-32)?c<0?1:"\x95#\x8CKa`^ZRBCEIQiw#S#nx(37+$6-2&@/4)'18=,*%.:0;?5" [c-12]-34:-3;c/=2)
{
d=(c/2?46-c%2:32);
putchar (d);
}
return 0;
}

View File

@ -68,5 +68,6 @@ struct morse_timig_format {
};
int prepare_text2morse (int wpm);
int char2morse(void);

View File

@ -369,10 +369,11 @@ int main(int argc, char *argv[])
usleep(50);
}
#ifdef TX_SERIAL
if(kbhit() && tx_timer == 0){
char2morse("s");
getchar(); /* flush the buffer */
char2morse();
}
#endif
} /* End of mainloop */
send(fd_socket, &disconnect_packet, SIZE_COMMAND_PACKET, 0);