Subversion Repositories DashDisplay

Rev

Rev 8 | Rev 10 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8 Rev 9
Line 116... Line 116...
116
        {
116
        {
117
                ItemIndex = 0;
117
                ItemIndex = 0;
118
                dial_pos[dial] = 0;
118
                dial_pos[dial] = 0;
119
        }
119
        }
120
 
120
 
-
 
121
 
-
 
122
 
121
        // check for item suppression
123
        // check for item suppression
122
        if(ItemIndex == suppress)
124
        if(ItemIndex == suppress)
123
        {
125
        {
124
                dial1[dial] = -1;
126
                dial1[dial] = -1;
125
                OldObservation[dial] = -1;
127
                OldObservation[dial] = -1;
Line 140... Line 142...
140
                // now to convert the readings and format strings
142
                // now to convert the readings and format strings
141
                // find out limits
143
                // find out limits
142
                char * msg;
144
                char * msg;
143
                int len;
145
                int len;
144
 
146
 
-
 
147
                // if the user presses the dial then reset min/max to current value
-
 
148
                if(push_pos[dial] == 1)
-
 
149
                {
-
 
150
                                Max[ItemIndex] = DataVal;
-
 
151
                                Min[ItemIndex] = DataVal; // 12 bit max value
-
 
152
                }
-
 
153
 
-
 
154
 
-
 
155
 
145
                if (Observation < PLX_MAX_OBS)
156
                if (Observation < PLX_MAX_OBS)
146
                {
157
                {
147
                        if (Observation != OldObservation[dial]
158
                        if (Observation != OldObservation[dial]
148
                                        || ObservationIndex != OldObservationIndex[dial])
159
                                        || ObservationIndex != OldObservationIndex[dial])
149
                        {
160
                        {
Line 151... Line 162...
151
                                clearDisplay();
162
                                clearDisplay();
152
                                dial_draw_scale(
163
                                dial_draw_scale(
153
                                                DisplayInfo[Observation].Low
164
                                                DisplayInfo[Observation].Low
154
                                                                / DisplayInfo[Observation].TickScale,
165
                                                                / DisplayInfo[Observation].TickScale,
155
                                                DisplayInfo[Observation].High
166
                                                DisplayInfo[Observation].High
156
                                                                / DisplayInfo[Observation].TickScale, 16, 1);
167
                                                                / DisplayInfo[Observation].TickScale, 12, 1);
157
                                if (ObservationIndex > 0)
168
                                if (ObservationIndex > 0)
158
                                {
169
                                {
159
                                        len = 5;
170
                                        len = 5;
160
                                        buff[6] = ObservationIndex + '1';
171
                                        buff[6] = ObservationIndex + '1';
161
                                }
172
                                }
Line 181... Line 192...
181
 
192
 
182
                        double max_rdg;
193
                        double max_rdg;
183
                        double min_rdg;
194
                        double min_rdg;
184
                        double cur_rdg;
195
                        double cur_rdg;
185
                        int int_rdg;
196
                        int int_rdg;
-
 
197
                        int int_max;
-
 
198
                        int int_min;
186
 
199
 
187
                        max_rdg = ConveriMFDRaw2Data(Observation,
200
                        max_rdg = ConveriMFDRaw2Data(Observation,
188
                                        DisplayInfo[Observation].Units, Max[ItemIndex]);
201
                                        DisplayInfo[Observation].Units, Max[ItemIndex]);
189
                        min_rdg = ConveriMFDRaw2Data(Observation,
202
                        min_rdg = ConveriMFDRaw2Data(Observation,
190
                                        DisplayInfo[Observation].Units, Min[ItemIndex]);
203
                                        DisplayInfo[Observation].Units, Min[ItemIndex]);
Line 195... Line 208...
195
                        int dp_pos;  // where to print the decimal place
208
                        int dp_pos;  // where to print the decimal place
196
                        switch (DisplayInfo[Observation].DP)
209
                        switch (DisplayInfo[Observation].DP)
197
                        {
210
                        {
198
                        case 0:
211
                        case 0:
199
                                int_rdg = (int) (cur_rdg);
212
                                int_rdg = (int) (cur_rdg);
-
 
213
                                int_max = (int) (max_rdg);
-
 
214
                                int_min = (int) (min_rdg);
200
                                dp_pos = 100;
215
                                dp_pos = 100;
201
                                break;
216
                                break;
202
                        case 1:
217
                        case 1:
203
                                int_rdg = (int) (cur_rdg * 10.0);
218
                                int_rdg = (int) (cur_rdg * 10.0);
-
 
219
                                int_max = (int) (max_rdg * 10.0);
-
 
220
                                int_min = (int) (min_rdg * 10.0);
204
                                dp_pos = 3;
221
                                dp_pos = 3;
205
                                break;
222
                                break;
206
                        case 2:
223
                        case 2:
207
                                int_rdg = (int) (cur_rdg * 100.0);
224
                                int_rdg = (int) (cur_rdg * 100.0);
-
 
225
                                int_max = (int) (max_rdg * 100.0);
-
 
226
                                int_min = (int) (min_rdg * 100.0);
208
                                dp_pos = 2;
227
                                dp_pos = 2;
209
                                break;
228
                                break;
210
                        }
229
                        }
211
 
230
 
212
                        cur_rdg -= DisplayInfo[Observation].Low;
231
                        cur_rdg -= DisplayInfo[Observation].Low;
Line 223... Line 242...
223
                        }
242
                        }
224
                        dial_draw_needle(dial0[dial]);
243
                        dial_draw_needle(dial0[dial]);
225
                        // print value overlaid by needle
244
                        // print value overlaid by needle
226
                        // this is actual reading
245
                        // this is actual reading
227
                        print_digits(64 - 16, 30, 4, dp_pos, int_rdg);
246
                        print_digits(64 - 16, 30, 4, dp_pos, int_rdg);
-
 
247
                        font_gotoxy(0,0);
-
 
248
                        font_digits(4,dp_pos,int_min);
-
 
249
                        font_gotoxy(0,1);
-
 
250
                        font_puts("Min");
-
 
251
 
-
 
252
                        font_gotoxy(17,0);
-
 
253
                        font_digits(4,dp_pos,int_max);
-
 
254
                        font_gotoxy(18,1);
-
 
255
                        font_puts("Max");
228
 
256
 
229
                        dial1[dial] = dial0[dial];
257
                        dial1[dial] = dial0[dial];
230
 
258
 
231
                        display();
259
                        display();
232
 
260
 
Line 312... Line 340...
312
                //font_puts(
340
                //font_puts(
313
                //              "Hello world !!\rThis text is a test of the text rendering library in a 5*7 font");
341
                //              "Hello world !!\rThis text is a test of the text rendering library in a 5*7 font");
314
 
342
 
315
                dial_origin(64, 60);
343
                dial_origin(64, 60);
316
                dial_size(60);
344
                dial_size(60);
317
                dial_draw_scale(0, 10, 16, 5);
345
                dial_draw_scale(0, 10, 12, 5);
318
 
346
 
319
                display();
347
                display();
320
 
348
 
321
        }
349
        }
322
        InitSwitches();
350
        InitSwitches();
Line 342... Line 370...
342
        while (1)
370
        while (1)
343
        {
371
        {
344
// poll switches
372
// poll switches
345
                HandleSwitches();
373
                HandleSwitches();
346
 
374
 
-
 
375
 
-
 
376
 
-
 
377
 
347
                uint16_t cc = SerialCharsReceived(&uc1);
378
                uint16_t cc = SerialCharsReceived(&uc1);
348
                int chr;
379
                int chr;
349
                for (chr = 0; chr < cc; chr++)
380
                for (chr = 0; chr < cc; chr++)
350
                {
381
                {
351
                        char c = GetCharSerial(&uc1);
382
                        char c = GetCharSerial(&uc1);