Skip to content

Commit 1d07bbd

Browse files
author
Peter Wegmann
committed
SC mask received from Server
1 parent 127480a commit 1d07bbd

File tree

7 files changed

+138
-103
lines changed

7 files changed

+138
-103
lines changed

Controller/base_controller.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,20 @@ void handle_received_Messages(Controller_Model *Model){
14611461

14621462
break;
14631463
}
1464+
1465+
case SET_SC_XBEE_MASK:
1466+
1467+
LVM.options->SC_mask = (frameBuffer[reply_Id].data[0]<<8) + frameBuffer[reply_Id].data[1];
1468+
LVM.options->SC_mask_alerady_received = SC_already_received_Pattern;
1469+
1470+
// write new sc mask to eeprom
1471+
eeprom_update_word(&LVM.eeprom->eeOptions.SC_mask,LVM.options->SC_mask);
1472+
eeprom_update_byte(&LVM.eeprom->eeOptions.SC_mask_alerady_received,LVM.options->SC_mask_alerady_received);
1473+
1474+
//refresh xbee parameters
1475+
xbee_init(&paint_info_line,LVM.vars->Device_ID_Str,DEV_ID_CHARS_MAX,LVM.options->SC_mask);
1476+
xbee_Set_Scan_Channels(xbee.ScanChannels);
1477+
xbee_WR();
14641478

14651479

14661480
case DEPRECATED_ILM_BROADCAST: // ILM messages are sent in broadcast mode and are ignored by other devices

Controller/main_mode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ void main_pressedDOWN(Controller_Model *Model){
283283

284284
if (xbee.netstat == NO_NETWORK)
285285
{
286-
xbee_Set_Scan_Channels(SC_MASK_DEFAULT);
286+
xbee_Set_Scan_Channels(LVM.options->SC_mask);
287287
xbee_WR();
288288
}
289289

LHe-Level-Meter.cproj

Lines changed: 92 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<ToolName>STK500</ToolName>
5555
</com_atmel_avrdbg_tool_stk500>
5656
<avrtoolinterface>ISP</avrtoolinterface>
57-
<avrtoolinterfaceclock>930509</avrtoolinterfaceclock>
57+
<avrtoolinterfaceclock>125000</avrtoolinterfaceclock>
5858
<com_atmel_avrdbg_tool_simulator>
5959
<ToolOptions>
6060
<InterfaceProperties>
@@ -69,7 +69,7 @@
6969
<com_atmel_avrdbg_tool_powerdebugger>
7070
<ToolOptions>
7171
<InterfaceProperties>
72-
<IspClock>930509</IspClock>
72+
<IspClock>125000</IspClock>
7373
<JtagDbgClock>220000</JtagDbgClock>
7474
<JtagEnableExtResetOnStartSession>true</JtagEnableExtResetOnStartSession>
7575
<JtagInChain>false</JtagInChain>
@@ -209,102 +209,102 @@
209209
<PropertyGroup Condition=" '$(Configuration)' == 'ili9341-ILL' ">
210210
<ToolchainSettings>
211211
<AvrGcc>
212-
<avrgcc.common.Device>-mmcu=atmega1284p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\gcc\dev\atmega1284p"</avrgcc.common.Device>
213-
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
214-
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
215-
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
216-
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
217-
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
218-
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
219-
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
220-
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
221-
<avrgcc.compiler.symbols.DefSymbols>
222-
<ListValues>
223-
<Value>F_CPU=6144000UL</Value>
224-
<Value>DEBUG</Value>
225-
<Value>LEVELMETER</Value>
226-
<Value>USE_XBEE</Value>
227-
<Value>ili9341</Value>
228-
<Value>ILL_DISP_CONFIG</Value>
229-
</ListValues>
230-
</avrgcc.compiler.symbols.DefSymbols>
231-
<avrgcc.compiler.directories.IncludePaths>
232-
<ListValues>
233-
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\include</Value>
234-
<Value>../avr-util-library</Value>
235-
</ListValues>
236-
</avrgcc.compiler.directories.IncludePaths>
237-
<avrgcc.compiler.optimization.level>Optimize most (-O3)</avrgcc.compiler.optimization.level>
238-
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
239-
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
240-
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
241-
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
242-
<avrgcc.compiler.miscellaneous.Verbose>True</avrgcc.compiler.miscellaneous.Verbose>
243-
<avrgcc.linker.libraries.Libraries>
244-
<ListValues>
245-
<Value>libm</Value>
246-
</ListValues>
247-
</avrgcc.linker.libraries.Libraries>
248-
<avrgcc.assembler.general.AssemblerFlags>-DLEVELMETER</avrgcc.assembler.general.AssemblerFlags>
249-
<avrgcc.assembler.general.IncludePaths>
250-
<ListValues>
251-
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.98\include</Value>
252-
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\include</Value>
253-
</ListValues>
254-
</avrgcc.assembler.general.IncludePaths>
255-
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
256-
</AvrGcc>
212+
<avrgcc.common.Device>-mmcu=atmega1284p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\gcc\dev\atmega1284p"</avrgcc.common.Device>
213+
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
214+
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
215+
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
216+
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
217+
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
218+
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
219+
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
220+
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
221+
<avrgcc.compiler.symbols.DefSymbols>
222+
<ListValues>
223+
<Value>F_CPU=6144000UL</Value>
224+
<Value>DEBUG</Value>
225+
<Value>LEVELMETER</Value>
226+
<Value>USE_XBEE</Value>
227+
<Value>ili9341</Value>
228+
<Value>ILL_DISP_CONFIG</Value>
229+
</ListValues>
230+
</avrgcc.compiler.symbols.DefSymbols>
231+
<avrgcc.compiler.directories.IncludePaths>
232+
<ListValues>
233+
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\include</Value>
234+
<Value>../avr-util-library</Value>
235+
</ListValues>
236+
</avrgcc.compiler.directories.IncludePaths>
237+
<avrgcc.compiler.optimization.level>Optimize most (-O3)</avrgcc.compiler.optimization.level>
238+
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
239+
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
240+
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
241+
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
242+
<avrgcc.compiler.miscellaneous.Verbose>True</avrgcc.compiler.miscellaneous.Verbose>
243+
<avrgcc.linker.libraries.Libraries>
244+
<ListValues>
245+
<Value>libm</Value>
246+
</ListValues>
247+
</avrgcc.linker.libraries.Libraries>
248+
<avrgcc.assembler.general.AssemblerFlags>-DLEVELMETER</avrgcc.assembler.general.AssemblerFlags>
249+
<avrgcc.assembler.general.IncludePaths>
250+
<ListValues>
251+
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.98\include</Value>
252+
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\include</Value>
253+
</ListValues>
254+
</avrgcc.assembler.general.IncludePaths>
255+
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
256+
</AvrGcc>
257257
</ToolchainSettings>
258258
<OutputPath>bin\ili9341-ILL\</OutputPath>
259259
</PropertyGroup>
260260
<PropertyGroup Condition=" '$(Configuration)' == 'DISP_3000-ILL' ">
261261
<ToolchainSettings>
262262
<AvrGcc>
263-
<avrgcc.common.Device>-mmcu=atmega1284p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\gcc\dev\atmega1284p"</avrgcc.common.Device>
264-
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
265-
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
266-
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
267-
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
268-
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
269-
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
270-
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
271-
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
272-
<avrgcc.compiler.symbols.DefSymbols>
273-
<ListValues>
274-
<Value>F_CPU=6144000UL</Value>
275-
<Value>DEBUG</Value>
276-
<Value>LEVELMETER</Value>
277-
<Value>USE_XBEE</Value>
278-
<Value>DISP_3000</Value>
279-
<Value>ILL_DISP_CONFIG</Value>
280-
</ListValues>
281-
</avrgcc.compiler.symbols.DefSymbols>
282-
<avrgcc.compiler.directories.IncludePaths>
283-
<ListValues>
284-
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\include</Value>
285-
<Value>../avr-util-library</Value>
286-
</ListValues>
287-
</avrgcc.compiler.directories.IncludePaths>
288-
<avrgcc.compiler.optimization.level>Optimize most (-O3)</avrgcc.compiler.optimization.level>
289-
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
290-
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
291-
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
292-
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
293-
<avrgcc.compiler.miscellaneous.Verbose>True</avrgcc.compiler.miscellaneous.Verbose>
294-
<avrgcc.linker.libraries.Libraries>
295-
<ListValues>
296-
<Value>libm</Value>
297-
</ListValues>
298-
</avrgcc.linker.libraries.Libraries>
299-
<avrgcc.assembler.general.AssemblerFlags>-DLEVELMETER</avrgcc.assembler.general.AssemblerFlags>
300-
<avrgcc.assembler.general.IncludePaths>
301-
<ListValues>
302-
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.98\include</Value>
303-
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\include</Value>
304-
</ListValues>
305-
</avrgcc.assembler.general.IncludePaths>
306-
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
307-
</AvrGcc>
263+
<avrgcc.common.Device>-mmcu=atmega1284p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\gcc\dev\atmega1284p"</avrgcc.common.Device>
264+
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
265+
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
266+
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
267+
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
268+
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
269+
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
270+
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
271+
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
272+
<avrgcc.compiler.symbols.DefSymbols>
273+
<ListValues>
274+
<Value>F_CPU=6144000UL</Value>
275+
<Value>DEBUG</Value>
276+
<Value>LEVELMETER</Value>
277+
<Value>USE_XBEE</Value>
278+
<Value>DISP_3000</Value>
279+
<Value>ILL_DISP_CONFIG</Value>
280+
</ListValues>
281+
</avrgcc.compiler.symbols.DefSymbols>
282+
<avrgcc.compiler.directories.IncludePaths>
283+
<ListValues>
284+
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\include</Value>
285+
<Value>../avr-util-library</Value>
286+
</ListValues>
287+
</avrgcc.compiler.directories.IncludePaths>
288+
<avrgcc.compiler.optimization.level>Optimize most (-O3)</avrgcc.compiler.optimization.level>
289+
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
290+
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
291+
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
292+
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
293+
<avrgcc.compiler.miscellaneous.Verbose>True</avrgcc.compiler.miscellaneous.Verbose>
294+
<avrgcc.linker.libraries.Libraries>
295+
<ListValues>
296+
<Value>libm</Value>
297+
</ListValues>
298+
</avrgcc.linker.libraries.Libraries>
299+
<avrgcc.assembler.general.AssemblerFlags>-DLEVELMETER</avrgcc.assembler.general.AssemblerFlags>
300+
<avrgcc.assembler.general.IncludePaths>
301+
<ListValues>
302+
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.0.98\include</Value>
303+
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\include</Value>
304+
</ListValues>
305+
</avrgcc.assembler.general.IncludePaths>
306+
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
307+
</AvrGcc>
308308
</ToolchainSettings>
309309
<OutputPath>bin\DISP_3000-ILL\</OutputPath>
310310
</PropertyGroup>

avr-util-library

config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313

1414

15-
#define FIRMWARE_VERSION 219
15+
#define FIRMWARE_VERSION 220
1616

1717
#define BRANCH_ID 1
18-
#define LAST_FIRMWARE_EEPROM_CHANGED 206
18+
#define LAST_FIRMWARE_EEPROM_CHANGED 220
1919

2020

2121

main.c

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ eememType EEMEM eeVars = {
106106
.eeOptions.display_reversed = false,
107107
.eeOptions.Dev_ID_alpahnum = DEVICE_ID_ALPHANUMERIC ,
108108
.eeOptions.Dev_ID_Max_len = DEVICE_ID_UI_MAX_LEN,
109+
.eeOptions.SC_mask = SC_MASK_DEFAULT,
110+
.eeOptions.SC_mask_alerady_received = 0,
109111
.eeprom_changed = EEPROM_CHANGED_DEF
112+
110113
};
111114

112115
#endif
@@ -143,8 +146,9 @@ optionsType Options ={
143146
.total_volume = TOTAL_VOL_DEF,
144147
.display_reversed = false,
145148
.Dev_ID_alpahnum = DEVICE_ID_ALPHANUMERIC ,
146-
.Dev_ID_Max_len = DEVICE_ID_UI_MAX_LEN
147-
149+
.Dev_ID_Max_len = DEVICE_ID_UI_MAX_LEN,
150+
.SC_mask = SC_MASK_DEFAULT,
151+
.SC_mask_alerady_received = 0
148152
};
149153

150154

@@ -600,8 +604,9 @@ void write_DEFS_to_EEPROM(void){
600604
.display_reversed = false,
601605
.Dev_ID_alpahnum = false,
602606
.Dev_ID_Max_len = DEV_ID_CHARS_DEF,
603-
.options_pw = OPTIONS_PW_DEF
604-
607+
.options_pw = OPTIONS_PW_DEF,
608+
.SC_mask = SC_MASK_DEFAULT,
609+
.SC_mask_alerady_received = 0
605610

606611
};
607612

@@ -659,13 +664,27 @@ int main(void)
659664
//=========================================================================
660665
#ifdef ALLOW_EEPROM_SAVING
661666
LVM.options->display_reversed = eeprom_read_byte(&eeVars.eeOptions.display_reversed);
667+
uint8_t SC_already_received = eeprom_read_byte(&eeVars.eeOptions.SC_mask_alerady_received);
668+
uint8_t SC_EEPROM = eeprom_read_word(&eeVars.eeOptions.SC_mask);
669+
662670
#endif
663671

664672
version_INIT(FIRMWARE_VERSION,BRANCH_ID,LAST_FIRMWARE_EEPROM_CHANGED);
665-
xbee_init(&paint_info_line,LVM.vars->Device_ID_Str,DEV_ID_CHARS_MAX);
673+
674+
if (SC_already_received == SC_already_received_Pattern)
675+
{
676+
xbee_init(&paint_info_line,LVM.vars->Device_ID_Str,DEV_ID_CHARS_MAX,SC_EEPROM);
677+
LVM.options->SC_mask = SC_EEPROM;
678+
}else
679+
{
680+
xbee_init(&paint_info_line,LVM.vars->Device_ID_Str,DEV_ID_CHARS_MAX,SC_MASK_DEFAULT);
681+
LVM.options->SC_mask = SC_MASK_DEFAULT;
682+
}
666683

667684

668685
LCD_Init();
686+
687+
669688

670689

671690
// XBee module (PORTA.6)
@@ -874,7 +893,7 @@ int main(void)
874893
}
875894
#endif // ili9341
876895

877-
xbee_Set_Scan_Channels(SC_MASK_DEFAULT);
896+
xbee_Set_Scan_Channels(xbee.ScanChannels);
878897
xbee_WR();
879898

880899
#if 1

main.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@ typedef struct{
245245
uint8_t display_reversed;
246246
_Bool Dev_ID_alpahnum;
247247
uint8_t Dev_ID_Max_len;
248-
uint16_t options_pw;
248+
uint16_t options_pw;
249+
uint16_t SC_mask;
250+
uint8_t SC_mask_alerady_received;
249251
}optionsType;
250252

251253

0 commit comments

Comments
 (0)