Subversion Repositories DashDisplay

Rev

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

Rev 74 Rev 75
Line 23... Line 23...
23
{
23
{
24
        int const WIDTH = 128;
24
        int const WIDTH = 128;
25
        int const HEIGHT = 64;
25
        int const HEIGHT = 64;
26
        int const DISPLAY_RAMWIDTH = 132;
26
        int const DISPLAY_RAMWIDTH = 132;
27
 
27
 
28
        uniqueObs_t const nullObs = {PLX_MAX_OBS, PLX_MAX_INST};
-
 
29
}
28
}
30
 
29
 
31
uint8_t displayBuffer[2][dataSize(WIDTH, HEIGHT)];
30
uint8_t displayBuffer[2][dataSize(WIDTH, HEIGHT)];
32
 
31
 
33
stm32_halDisplay_t displays[MAX_DISPLAYS] =
32
stm32_halDisplay_t displays[MAX_DISPLAYS] =
Line 126... Line 125...
126
                // check for timer timeout on consistent timer
125
                // check for timer timeout on consistent timer
127
 
126
 
128
                if (context.dial_timer)
127
                if (context.dial_timer)
129
                {
128
                {
130
                        context.dial_timer--;
129
                        context.dial_timer--;
-
 
130
                }
131
                        if (context.dial_timer == 0)
131
                if (context.dial_timer == 0)
-
 
132
                {
-
 
133
                        context.dial_timer = DialTimeout;
-
 
134
                        int i;
-
 
135
                        // use dialIndex+1 as tag for data : always non-zero.
-
 
136
                        nvram_info_t *dial_nvram = find_nvram_data(dialIndex + 1);
-
 
137
 
-
 
138
                        if (dial_nvram && context.knobPos < 0)
-
 
139
                        {
-
 
140
                                for (i = 0; i < MAXRDG; i++)
-
 
141
                                        if (isValid(i) && (Info[i].observation.Obs == dial_nvram->data.observation) && (Info[i].observation.Instance == dial_nvram->data.instance))
-
 
142
                                        {
-
 
143
                                                context.knobPos = i;
-
 
144
                                                return;
-
 
145
                                        }
-
 
146
                        }
-
 
147
                        if (context.knobPos == -1)
-
 
148
                                context.knobPos = dialIndex; // timed out , not in NVRAM, use a default
-
 
149
 
-
 
150
                        // dont save dial info for invalid data
-
 
151
                        if (!isValid(context.knobPos))
-
 
152
                                return;
-
 
153
                        // is this a change since the last timeout ?
-
 
154
 
-
 
155
                        if (!dial_nvram || (Info[context.knobPos].observation.Obs != dial_nvram->data.observation) || (Info[context.knobPos].observation.Instance != dial_nvram->data.instance))
132
                        {
156
                        {
133
                                context.dial_timer = DialTimeout;
-
 
134
                                int i;
-
 
135
                                // use dialIndex+1 as tag for data : always non-zero.
-
 
136
                                nvram_info_t *dial_nvram = find_nvram_data(dialIndex + 1);
-
 
137
 
-
 
138
                                if (dial_nvram && context.knobPos < 0)
-
 
139
                                {
-
 
140
                                        for (i = 0; i < MAXRDG; i++)
-
 
141
                                                if (isValid(i) && (Info[i].observation.Obs == dial_nvram->data.observation) && (Info[i].observation.Instance == dial_nvram->data.instance))
-
 
142
                                                {
-
 
143
                                                        context.knobPos = i;
-
 
144
                                                        return;
-
 
145
                                                }
-
 
146
                                }
-
 
147
                                if (context.knobPos == -1)
-
 
148
                                        context.knobPos = dialIndex; // timed out , not in NVRAM, use a default
-
 
149
 
-
 
150
                                // dont save dial info for invalid data
-
 
151
                                if (!isValid(context.knobPos))
-
 
152
                                        return;
-
 
153
                                // is this a change since the last timeout ?
-
 
154
 
-
 
155
                                if (!dial_nvram || (Info[context.knobPos].observation.Obs != dial_nvram->data.observation) || (Info[context.knobPos].observation.Instance != dial_nvram->data.instance))
-
 
156
                                {
-
 
157
 
-
 
158
                                        // store the observation and instance in the NVRAM, not dial position.
-
 
159
                                        nvram_info_t curr_val;
-
 
160
                                        curr_val.data.observation = Info[context.knobPos].observation.Obs;
-
 
161
                                        curr_val.data.instance = Info[context.knobPos].observation.Instance;
-
 
162
                                        curr_val.data.tag = dialIndex + 1;
-
 
163
 
157
 
-
 
158
                                // store the observation and instance in the NVRAM, not dial position.
164
                                        write_nvram_data(curr_val);
159
                                nvram_info_t curr_val;
-
 
160
                                curr_val.data.observation = Info[context.knobPos].observation.Obs;
-
 
161
                                curr_val.data.instance = Info[context.knobPos].observation.Instance;
-
 
162
                                curr_val.data.tag = dialIndex + 1;
165
                                }
163
 
-
 
164
                                write_nvram_data(curr_val);
166
                        }
165
                        }
167
                }
166
                }
168
        }
167
        }
169
 
168
 
170
        int
169
        int
Line 178... Line 177...
178
                displayDial_t &dial = dials[dialIndex];
177
                displayDial_t &dial = dials[dialIndex];
179
                stm32_halDisplay_t &display = displays[dialIndex];
178
                stm32_halDisplay_t &display = displays[dialIndex];
180
                int itemIndex = context.knobPos;
179
                int itemIndex = context.knobPos;
181
                char buff[10];
180
                char buff[10];
182
                int i;
181
                int i;
183
                char *msg;
182
                const char *msg;
184
                int len;
183
                int len;
185
                // check for startup phase
184
                // check for startup phase
186
                if (itemIndex < 0)
185
                if (itemIndex < 0)
187
                {
186
                {
188
                        display.clearDisplay(BLACK);
187
                        display.clearDisplay(BLACK);