無線ブログ集
メイン | 簡易ヘッドライン |
TS820-DDS-VFOその13 (2022/3/1 4:49:55)
TS820-DDS-VFOの組込のTFT液晶表示部へのRIT周波数、及び送信、受信状態の表示の追加のスケッチ防備録です。
■RIT周波数のTFT表示に関して
RIT周波数の変化分はtawase
に入りますが、この変数に入った値をsprintfで表示させるのですが、0Hzのときの表示がtawase変数をsprintf(str,"%03d",tawase)の%03dの書式表示させると ”000”Hzと表示されてしまいます。やはり0Hzの時の表示は”0"Hzにしたいので、+側(0から+1000Hz)はあえてTFT表示は直接文字を書き込みするように変更しました。(1箇所の0Hz表示だけの対応で良かったのですが、TFTの桁位置設定が楽に出来るので直接ストリング表示の sprintf(str,"%s","
0");の%sの書式表示を使い+1000まで対応しました。ー側の整数値は問題ないので
tawase値の”%03d"書式表示を使っています。)なお、TFT表示はtawaseの値で振り分ける構造化のswitch
caseを使いスケッチしてあります。
sprintf(str,"%03d",tawase); →
sprintf(str,"%s"," 0");
ストリング書式での直接書き込みにすることで、RITを設定してない時は
”0”Hzの表示になります。0から+側のRIT周波数の各設定時のTFT表示は下記の"
"内の記載の様にしています。(単位は別途単独表示です。)
"0"Hz,"+100"Hz
,"+200"Hz,"+300"Hz,"+400"Hz,"+500"Hz,"+600"Hz,"+700"Hz,"+800"Hz,
"+900"Hz,"+1000"Hz
■定義部分の追加(RIT周波数)
int32_t RRIT_frq; //RX RIT-frequency ADD 2022/FEB/27
■void loop()ルーチン分への追加です。 黄色 部が 追加修正箇所
//-----------------------------------------------------------------------------------------------
void loop() { // (core1)
//-----------------------------------------------------------------------------------------------
char str[64];
if(f_dchange==1){ //if need to renew display, set this flag to 1
f_dchange=0; //if frequency changed, set this flag to 1
//GRAM_clr();
boxfill(0,0,Nx-1,Ny-1,cl_BG);
//Display Dial
Dial(frq);
// box(7,100,153,126, 0xa0a0a0);
// box(6,99,154,127, 0xa0a0a0);
//-------- Display Digital Frquency ---------------------------------------
sprintf(str, "%3d.%03d,%02d", frq/1000000, (frq/1000)%1000, (frq/10)%100 );
disp_str16(str,17, 110, 0xffd080);
sprintf(str, "MHz" );
disp_str12(str,120, 111, 0xffd080);
// Condition TX,RX display add FEB27 **************************************************
// Display RX RIT frquency ADD 2022/FEB/27
sprintf(str ,"%3d.%03d,%02d", RRIT_frq/1000000,(RRIT_frq/1000)%1000,(RRIT_frq/10)%100);
disp_str16(str,17, 70, 0xffd080);
switch (tawase){
case 0:
sprintf(str,"%s"," 0"); //Only 0 NOUSE tawase variable
disp_str16(str,84,90,0xffd080);
break;
case 100:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+100");
disp_str16(str,84,90,0xffd080);
break;
case 200:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+200");
disp_str16(str,84,90,0xffd080);
break;
case 300:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+300");
disp_str16(str,84,90,0xffd080);
break;
case 400:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+400");
disp_str16(str,84,90,0xffd080);
break;
case 500:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+500");
disp_str16(str,84,90,0xffd080);
break;
case 600:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+600");
disp_str16(str,84,90,0xffd080);
break;
case 700:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+700");
disp_str16(str,84,90,0xffd080);
break;
case 800:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+800");
disp_str16(str,84,90,0xffd080);
break;
case 900:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+900");
disp_str16(str,84,90,0xffd080);
break;
case 1000:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+1000");
disp_str16(str,74,90,0xffd080); // adjusting degit location x
break;
case -100:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -200:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -300:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -400:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -500:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -600:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -700:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -800:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -900:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -1000:
sprintf(str,"%03d",tawase);
disp_str16(str,74,90,0xffd080); // adjusting degit location x
break;
default:
break;
}
// RIT_frq Unit Setting
sprintf(str,"Hz");
disp_str12(str,132,92, 0xffd080);
if(digitalRead(TX_SW) == HIGH){
sprintf(str,"RX: RIT:");
disp_str12(str,0,92,0xffd080);
}
else {
if(digitalRead(TX_SW) == LOW){
sprintf(str,"TX:");
disp_str12(str,0,112,0xffd080);
}
//*************************************************************************************
}
if(f_redraw==0){
trans65k(); //Convert 24bit image to 16bit image
f_redraw=1; //uint8_t f_redraw;
}
}
void loop() { // (core1)
//-----------------------------------------------------------------------------------------------
char str[64];
if(f_dchange==1){ //if need to renew display, set this flag to 1
f_dchange=0; //if frequency changed, set this flag to 1
//GRAM_clr();
boxfill(0,0,Nx-1,Ny-1,cl_BG);
//Display Dial
Dial(frq);
// box(7,100,153,126, 0xa0a0a0);
// box(6,99,154,127, 0xa0a0a0);
//-------- Display Digital Frquency ---------------------------------------
sprintf(str, "%3d.%03d,%02d", frq/1000000, (frq/1000)%1000, (frq/10)%100 );
disp_str16(str,17, 110, 0xffd080);
sprintf(str, "MHz" );
disp_str12(str,120, 111, 0xffd080);
// Condition TX,RX display add FEB27 **************************************************
// Display RX RIT frquency ADD 2022/FEB/27
sprintf(str ,"%3d.%03d,%02d", RRIT_frq/1000000,(RRIT_frq/1000)%1000,(RRIT_frq/10)%100);
disp_str16(str,17, 70, 0xffd080);
switch (tawase){
case 0:
sprintf(str,"%s"," 0"); //Only 0 NOUSE tawase variable
disp_str16(str,84,90,0xffd080);
break;
case 100:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+100");
disp_str16(str,84,90,0xffd080);
break;
case 200:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+200");
disp_str16(str,84,90,0xffd080);
break;
case 300:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+300");
disp_str16(str,84,90,0xffd080);
break;
case 400:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+400");
disp_str16(str,84,90,0xffd080);
break;
case 500:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+500");
disp_str16(str,84,90,0xffd080);
break;
case 600:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+600");
disp_str16(str,84,90,0xffd080);
break;
case 700:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+700");
disp_str16(str,84,90,0xffd080);
break;
case 800:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+800");
disp_str16(str,84,90,0xffd080);
break;
case 900:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+900");
disp_str16(str,84,90,0xffd080);
break;
case 1000:
//sprintf(str,"%03d",tawase);
sprintf(str,"%s","+1000");
disp_str16(str,74,90,0xffd080); // adjusting degit location x
break;
case -100:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -200:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -300:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -400:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -500:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -600:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -700:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -800:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -900:
sprintf(str,"%03d",tawase);
disp_str16(str,84,90,0xffd080);
break;
case -1000:
sprintf(str,"%03d",tawase);
disp_str16(str,74,90,0xffd080); // adjusting degit location x
break;
default:
break;
}
// RIT_frq Unit Setting
sprintf(str,"Hz");
disp_str12(str,132,92, 0xffd080);
if(digitalRead(TX_SW) == HIGH){
sprintf(str,"RX: RIT:");
disp_str12(str,0,92,0xffd080);
}
else {
if(digitalRead(TX_SW) == LOW){
sprintf(str,"TX:");
disp_str12(str,0,112,0xffd080);
}
//*************************************************************************************
}
if(f_redraw==0){
trans65k(); //Convert 24bit image to 16bit image
f_redraw=1; //uint8_t f_redraw;
}
}
〜省略
}
■RIT周波数を変数に入れる追加 (void task0(void* arg)への追加箇所)
/*-----------------------------------------------------------------------------------------------
Alternative Loop (core0)
------------------------------------------------------------------------------------------------*/
void task0(void* arg)
{
while (1)
{
pcnt_get_counter_value(PCNT_UNIT_0, &RE_Count);
int count=RE_Count;
pcnt_counter_clear(PCNT_UNIT_0);
if(f_rev==1) count=-count;
if(count!=0){
f_dchange=1;
f_fchange=1;
frq+= count * freq_step;
if(frq>fmax) frq=fmax;
if(frq<fmin) frq=fmin;
}
//-------------------------------------
if(f_fchange==1){
f_fchange=0;
// Output Lo freq
//set_freq( frq + offset_frq );
p_frq = HET_FREQ-frq + offset_frq + awase + tawase ; // add RITfreq
//RX RIT-frequency ADD 2022/FEB/27,28
RRIT_frq = HET_FREQ - p_frq + 150 + tawase ;
set_freq( HET_FREQ - frq + offset_frq + awase); //change to ts820vfo
o_frq = frq - HET_FREQ + 5500000; //エンコーダー変化分
set_car_freq((car_frq + awase ), f_carON, 0);
}
//-------------------------------------
if(f_cchange==1){
f_cchange=0;
// Output Car freq
//set_car_freq(car_frq, f_carON, 0);
set_car_freq((car_frq + awase ), f_carON, 0);
}
if(f_redraw==1){
Transfer_Image();
f_redraw=0;
}
delay(1);
}
}
Alternative Loop (core0)
------------------------------------------------------------------------------------------------*/
void task0(void* arg)
{
while (1)
{
pcnt_get_counter_value(PCNT_UNIT_0, &RE_Count);
int count=RE_Count;
pcnt_counter_clear(PCNT_UNIT_0);
if(f_rev==1) count=-count;
if(count!=0){
f_dchange=1;
f_fchange=1;
frq+= count * freq_step;
if(frq>fmax) frq=fmax;
if(frq<fmin) frq=fmin;
}
//-------------------------------------
if(f_fchange==1){
f_fchange=0;
// Output Lo freq
//set_freq( frq + offset_frq );
p_frq = HET_FREQ-frq + offset_frq + awase + tawase ; // add RITfreq
//RX RIT-frequency ADD 2022/FEB/27,28
RRIT_frq = HET_FREQ - p_frq + 150 + tawase ;
set_freq( HET_FREQ - frq + offset_frq + awase); //change to ts820vfo
o_frq = frq - HET_FREQ + 5500000; //エンコーダー変化分
set_car_freq((car_frq + awase ), f_carON, 0);
}
//-------------------------------------
if(f_cchange==1){
f_cchange=0;
// Output Car freq
//set_car_freq(car_frq, f_carON, 0);
set_car_freq((car_frq + awase ), f_carON, 0);
}
if(f_redraw==1){
Transfer_Image();
f_redraw=0;
}
delay(1);
}
}
RIT周波数の設定時の表示と送信、受信の状態表示が上手く出来ました。あとは実際にRITを設定した状態での送信入力とTS820の送信コントロール信号線出力とを繋ぎ実際の送信時に上手く動作するかの確認が残っています。上手く行ったら試験運用もしてみたいと思います。
つづく?
execution time : 0.030 sec