-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bedienteil_IC-KL_25032022.ino
292 lines (232 loc) · 6.31 KB
/
Bedienteil_IC-KL_25032022.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#include <UTFT.h>
#include <URTouch.h>
#include <Arduino.h>
#include<stdlib.h>
#include <Eeprom24C32_64.h>
UTFT myGLCD(SSD1963_480,38,39,40,41);
URTouch myTouch( 6, 5, 4, 3, 2);
//Schriften Einbinden
extern uint8_t SmallFont[];
extern uint8_t hallfetica_normal[];
extern unsigned short icom[];
//Timer
unsigned long startMillis;
unsigned long currentMillis;
const unsigned long period = 250;//refreshzeit Nummerikanzeigen+Graphen in millisekunden
unsigned long startpeakMillis1;
unsigned long currentpeakMillis1;
const unsigned long peakperiod1 = 100;//refreshzeit Nummerikanzeigen+Graphen in millisekunden
unsigned long startpeakMillis2;
unsigned long currentpeakMillis2;
const unsigned long peakperiod2 = 100;//refreshzeit Nummerikanzeigen+Graphen in millisekunden
unsigned long startdebounceMillis;
unsigned long currentdebounceMillis;
const unsigned long debounceperiod = 250;//refreshzeit Nummerikanzeigen+Graphen in millisekunden
//EEPROM///
#define EEPROM_ADDRESS 0x57
static Eeprom24C32_64 eeprom(EEPROM_ADDRESS);
////////////////
//Touch
int x,y;
byte rgbtable_big[128][3]{
{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},
{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},{0,255,0},//grün54,24
{16,255,0},
{16,255,0},
{32,255,0},
{32,255,0},
{48,255,0},
{48,255,0},
{64,255,0},
{64,255,0},
{80,255,0},
{80,255,0},
{96,255,0},
{96,255,0},
{112,255,0},
{112,255,0},
{128,255,0},
{128,255,0},
{144,255,0},
{144,255,0},
{160,255,0},
{160,255,0},
{176,255,0},
{176,255,0},
{192,255,0},
{192,255,0},
{208,255,0},
{208,255,0},
{224,255,0},
{224,255,0},
{240,255,0},
{240,255,0},
{255,255,0},
{255,255,0},
{255,240,0},
{255,240,0},
{255,224,0},
{255,224,0},
{255,208,0},
{255,208,0},
{255,192,0},
{255,192,0},
{255,176,0},
{255,176,0},
{255,160,0},
{255,160,0},
{255,144,0},
{255,144,0},
{255,128,0},
{255,128,0},
{255,112,0},
{255,112,0},
{255,96,0},
{255,96,0},
{255,80,0},
{255,80,0},
{255,64,0},
{255,64,0},
{255,48,0},
{255,48,0},
{255,32,0},
{255,32,0},
{255,16,0},
{255,16,0},
{255,0,0},{255,0,0},{255,0,0},{255,0,0},{255,0,0},{255,0,0},{255,0,0},{255,0,0},{255,0,0},
{255,0,0},{255,0,0},{255,0,0},{255,0,0},{255,0,0},{255,0,0},{255,0,0},{255,0,0},{255,0,0},};
//Variablen
bool tx_state;
bool tx_state_old;
bool txl_state;
bool txl_state_old;
bool rx_tx;
bool refresh_tx_disp;
bool pwr_on;
bool pwr_on_stat;
bool touch_press;
bool tune;
bool tune_wait;
bool tune_state;
bool tune_state_old;
bool refresh_tune_disp;
bool fault_state;
bool fault_state_old;
bool refresh_fault_disp;
//*****Meter+++++++++
byte me1;
byte me1_graph;
byte me1_graph_old;
byte me2;
byte me2_graph;
byte me2_graph_old;
byte ic_bnd;
byte ya_bnd;
byte ic_ya;
byte band;
byte band_old;
byte automode;
//***Meter***
byte ME1;
byte MS1;
byte ME2;
byte MS2;
byte me1_multi;
byte me2_multi;
byte Meter_old;
int operate_mode;
int options_mode;
//**********Pin-Zuweisung****************
const byte txl_in = 11;
const byte tune_wait_in = 12;
const byte fault_in = 13;
const byte prol_sw = 42;
const byte temp_sw = 43;
const byte tx_in = 44;
const byte tx_out = 45;
const byte ic_d = 46;
const byte pson = 47;
const byte ic_c = 48;
const byte ic_b = 49;
const byte ic_bnd_v = 54;
const byte ic_bnd_ref = 55;
const byte me1_v = 56;
const byte me2_v = 57;
const byte swr_sw = 58;
const byte vc_sw = 59;
const byte po_sw = 60;
//const byte reserve = 61;
const byte a_y = 62;
const byte b_y = 63;
const byte c_y = 64;
const byte d_y = 65;
bool a;
bool b;
bool c;
bool d;
const byte band_v = 66;
const byte band_ref = 67;
const byte lin = 69;
const byte tun = 68;
void setup(){
startMillis = millis(); //initial start time
startpeakMillis1 = millis();
startpeakMillis2 = millis();
//Meters setup
pinMode(prol_sw,OUTPUT);
digitalWrite(prol_sw,LOW);
pinMode(temp_sw,OUTPUT);
digitalWrite(temp_sw,LOW);
pinMode(swr_sw,OUTPUT);
digitalWrite(swr_sw,LOW);
pinMode(vc_sw,OUTPUT);
digitalWrite(vc_sw,LOW);
pinMode(po_sw,OUTPUT);
digitalWrite(po_sw,LOW);
//********************************
pinMode(txl_in,INPUT);
digitalWrite(txl_in,INPUT_PULLUP);
pinMode(tune_wait_in,INPUT);
digitalWrite(tune_wait_in,INPUT_PULLUP);
pinMode(fault_in,INPUT);
digitalWrite(fault_in,INPUT_PULLUP);
pinMode(lin,OUTPUT); //lin
digitalWrite(lin,LOW);
pinMode(tun,OUTPUT); //tun
digitalWrite(tun,LOW);
pinMode(tx_in,INPUT_PULLUP); //TX IN
pinMode(tx_out,OUTPUT); //TX OUT
digitalWrite(tx_out,LOW);
pinMode(pson,OUTPUT); //PS ON
digitalWrite(pson,LOW);
pinMode(ic_d,INPUT_PULLUP); //Bandata from IC-4KL
pinMode(ic_c,INPUT_PULLUP); //Bandata from IC-4KL
pinMode(ic_b,INPUT_PULLUP); //Bandata from IC-4KL
pinMode(a_y,INPUT_PULLUP); //Band A
pinMode(b_y,INPUT_PULLUP); //Band B
pinMode(c_y,INPUT_PULLUP); //Band C
pinMode(d_y,INPUT_PULLUP); //Band D
pinMode(band_ref,OUTPUT); //Band reference voltage to IC-4KL
analogWrite(band_ref,255);
pinMode(band_v,OUTPUT); //Band voltage to IC-4KL
analogWrite(band_v,50);
//LCD Start
myGLCD.InitLCD();
myGLCD.clrScr();
myGLCD.setBackColor(VGA_TRANSPARENT);
myGLCD.drawBitmap(80,55,320,162,icom);
myGLCD.setFont(hallfetica_normal);
myGLCD.setColor(VGA_GRAY);
myGLCD.print("IC-4KL",320,215);
myGLCD.setFont(SmallFont);
myGLCD.print("by dj1yr",415,245);
myGLCD.print("built on " __DATE__ " at " __TIME__,225,260);
delay(2000);
//Touch Start
myTouch.InitTouch();
myTouch.setPrecision(PREC_MEDIUM);
//start Serial
Serial.begin(19200);
////EEPROM_32KB/////////////
eeprom.initialize();
}//END OF SETUP