Hi ,
I need using dimming server example to add FDS function. But I meet some unstable sitation.
The bellow is the log show how the issue happens.
//bellow : Start 0> <t: 0>, main.c, 808, ----- BLE Mesh Light Switch Server Demo ----- 0> <t: 0>, main.c, 839, rom_base 260DD 0> <t: 0>, main.c, 840, rom_end 4CBC0 0> <t: 0>, main.c, 841, rom_length 26AE3 0> <t: 0>, main.c, 842, bank_addr 4D000 0> <t: 0>, main.c, 849, serial timer start Now per 2S 0> <t: 552>, main.c, 724, Initializing and adding models 0> <t: 557>, main.c, 307, Sensor Handle:4 0> <t: 596>, main.c, 754, Initializing serial interface... 0> <t: 5328>, my_app_timer.c, 66, my app timer start... 0> <t: 5331>, main.c, 888, PWM max ticks: 10000 0> <t: 5333>, user.c, 494, ---FDS example started .--- 0> <t: 5336>, user.c, 499, Initializing fds... 0> <t: 5338>, user.c, 332, Event: FDS_EVT_INIT received (FDS_SUCCESS) 0> <t: 5341>, user.c, 512, Found 1 valid records. 0> <t: 5344>, user.c, 513, Found 3 dirty records (ready to be garbage collected). 0> <t: 5347>, user.c, 531, PWM Value is 90 and 40 0> <t: 5349>, user.c, 545, Config file found, updating boot count to 47. 0> <t: 5433>, user.c, 332, Event: FDS_EVT_UPDATE received (FDS_SUCCESS) 0> <t: 5436>, user.c, 357, Record ID: 0x0035 0> <t: 5438>, user.c, 358, File ID: 0xF010 0> <t: 5440>, user.c, 359, Record key: 0x7010 0> <t: 5575>, user.c, 332, Event: FDS_EVT_GC received (FDS_SUCCESS) 0> <t: 5578>, user.c, 386, Garbage Clear Completed ! 0> <t: 5591>, main.c, 912, Device UUID : 005955BB000000003C233B9C37904C5E 0> count = 2 0> <t: 57389>, main.c, 545, Send data 1 times 0> <t: 70866>, user.c, 203, ADC event number: 1 0> <t: 70869>, user.c, 209, 638 0> <t: 70871>, user.c, 209, 639 0> <t: 70872>, user.c, 209, 639 0> <t: 70874>, user.c, 209, 638 0> <t: 70876>, user.c, 209, 638 0> <t: 122925>, main.c, 545, Send data 2 times 0> <t: 136403>, user.c, 203, ADC event number: 2 0> <t: 136406>, user.c, 209, 639 0> <t: 136408>, user.c, 209, 637 0> <t: 136409>, user.c, 209, 640 0> <t: 136411>, user.c, 209, 641 0> <t: 136413>, user.c, 209, 639 0> <t: 188461>, main.c, 545, Send data 3 times 0> <t: 201941>, user.c, 203, ADC event number: 3 0> <t: 201943>, user.c, 209, 640 0> <t: 201945>, user.c, 209, 638 0> <t: 201947>, user.c, 209, 641 0> <t: 201949>, user.c, 209, 639 0> <t: 201951>, user.c, 209, 639 //===================== below: OK =============================// 0> <t: 453454>, app_level.c, 313, One Level cb happen ! 0> <t: 453456>, app_level.c, 314, Present Level: 86 0> <t: 453459>, app_level.c, 316, ELAPSED_TIME: 86 ,Transition Time: 1737 0> <t: 453462>, main.c, 268, m_pwm0_present_level is: 86 0> <t: 453464>, main.c, 291, Pwm value: 8600 0> <t: 454122>, app_level.c, 303, delta= 100 0> <t: 454124>, app_level.c, 313, One Level cb happen ! 0> <t: 454126>, app_level.c, 314, Present Level: 87 0> <t: 454129>, app_level.c, 316, ELAPSED_TIME: 87 ,Transition Time: 1758 0> <t: 454132>, main.c, 268, m_pwm0_present_level is: 87 0> <t: 454134>, main.c, 291, Pwm value: 8700 0> <t: 454792>, app_level.c, 303, delta= 100 0> <t: 454794>, app_level.c, 313, One Level cb happen ! 0> <t: 454796>, app_level.c, 314, Present Level: 88 0> <t: 454799>, app_level.c, 316, ELAPSED_TIME: 88 ,Transition Time: 1778 0> <t: 454802>, main.c, 268, m_pwm0_present_level is: 88 0> <t: 454804>, main.c, 291, Pwm value: 8800 0> <t: 455462>, app_level.c, 303, delta= 100 0> <t: 455464>, app_level.c, 313, One Level cb happen ! 0> <t: 455466>, app_level.c, 314, Present Level: 89 0> <t: 455469>, app_level.c, 316, ELAPSED_TIME: 89 ,Transition Time: 1799 0> <t: 455472>, main.c, 268, m_pwm0_present_level is: 89 0> <t: 455474>, main.c, 291, Pwm value: 8900 0> <t: 456132>, app_level.c, 303, delta= 100 0> <t: 456134>, app_level.c, 313, One Level cb happen ! 0> <t: 456136>, app_level.c, 314, Present Level: 90 0> <t: 456139>, app_level.c, 316, ELAPSED_TIME: 90 ,Transition Time: 1819 0> <t: 456142>, main.c, 268, m_pwm0_present_level is: 90 0> <t: 456144>, main.c, 291, Pwm value: 9000 0> <t: 456802>, app_level.c, 303, delta= 100 0> <t: 456804>, app_level.c, 313, One Level cb happen ! 0> <t: 456806>, app_level.c, 314, Present Level: 91 0> <t: 456809>, app_level.c, 316, ELAPSED_TIME: 91 ,Transition Time: 1839 0> <t: 456812>, main.c, 268, m_pwm0_present_level is: 91 0> <t: 456814>, main.c, 291, Pwm value: 9100 0> <t: 457472>, app_level.c, 303, delta= 100 0> <t: 457474>, app_level.c, 313, One Level cb happen ! 0> <t: 457476>, app_level.c, 314, Present Level: 93 0> <t: 457479>, app_level.c, 316, ELAPSED_TIME: 93 ,Transition Time: 1860 0> <t: 457482>, main.c, 268, m_pwm0_present_level is: 93 0> <t: 457484>, main.c, 291, Pwm value: 9300 0> <t: 458142>, app_level.c, 303, delta= 100 0> <t: 458144>, app_level.c, 313, One Level cb happen ! 0> <t: 458146>, app_level.c, 314, Present Level: 94 0> <t: 458149>, app_level.c, 316, ELAPSED_TIME: 94 ,Transition Time: 1880 0> <t: 458152>, main.c, 268, m_pwm0_present_level is: 94 0> <t: 458154>, main.c, 291, Pwm value: 9400 0> <t: 458812>, app_level.c, 303, delta= 100 0> <t: 458814>, app_level.c, 313, One Level cb happen ! 0> <t: 458816>, app_level.c, 314, Present Level: 95 0> <t: 458819>, app_level.c, 316, ELAPSED_TIME: 95 ,Transition Time: 1901 0> <t: 458822>, main.c, 268, m_pwm0_present_level is: 95 0> <t: 458824>, main.c, 291, Pwm value: 9500 0> <t: 459482>, app_level.c, 303, delta= 100 0> <t: 459484>, app_level.c, 313, One Level cb happen ! 0> <t: 459486>, app_level.c, 314, Present Level: 96 0> <t: 459489>, app_level.c, 316, ELAPSED_TIME: 96 ,Transition Time: 1921 0> <t: 459492>, main.c, 268, m_pwm0_present_level is: 96 0> <t: 459494>, main.c, 291, Pwm value: 9600 0> <t: 460152>, app_level.c, 303, delta= 100 0> <t: 460154>, app_level.c, 313, One Level cb happen ! 0> <t: 460156>, app_level.c, 314, Present Level: 97 0> <t: 460159>, app_level.c, 316, ELAPSED_TIME: 97 ,Transition Time: 1942 0> <t: 460162>, main.c, 268, m_pwm0_present_level is: 97 0> <t: 460164>, main.c, 291, Pwm value: 9700 0> <t: 460822>, app_level.c, 303, delta= 100 0> <t: 460824>, app_level.c, 313, One Level cb happen ! 0> <t: 460826>, app_level.c, 314, Present Level: 98 0> <t: 460829>, app_level.c, 316, ELAPSED_TIME: 98 ,Transition Time: 1962 0> <t: 460832>, main.c, 268, m_pwm0_present_level is: 98 0> <t: 460834>, main.c, 291, Pwm value: 9800 0> <t: 461492>, app_level.c, 303, delta= 100 0> <t: 461494>, app_level.c, 313, One Level cb happen ! 0> <t: 461496>, app_level.c, 314, Present Level: 99 0> <t: 461499>, app_level.c, 316, ELAPSED_TIME: 99 ,Transition Time: 1983 0> <t: 461502>, main.c, 268, m_pwm0_present_level is: 99 0> <t: 461504>, main.c, 291, Pwm value: 9900 0> <t: 462162>, access.c, 284, appkey_handle is 65535 0> <t: 462165>, access.c, 285, address_handle is 0 0> <t: 462167>, main.c, 268, m_pwm0_present_level is: 100 0> <t: 462170>, main.c, 291, Pwm value:10000 0> <t: 462172>, app_level.c, 337, Level_transition_complete: 100 0> <t: 462175>, app_level.c, 340, pwm_value is 100 ,Flag is 1 0> <t: 462178>, user.c, 606, Is Coming to FDS! 0> <t: 462180>, user.c, 611, Element 0, value is 100! 0> <t: 462182>, user.c, 622, === Found 1 valid records. 0> <t: 462185>, user.c, 623, === Found 1 dirty records. 0> <t: 462187>, user.c, 431, delete_next: 1,pending_flag:0. 0> <t: 462190>, user.c, 436, Deleting next record. 0> <t: 462194>, user.c, 414, Delete TRUE ! 0> <t: 465210>, user.c, 332, Event: FDS_EVT_DEL_RECORD received (FDS_SUCCESS) 0> <t: 465213>, user.c, 374, Record ID: 0x0036 0> <t: 465215>, user.c, 375, File ID: 0xF010 0> <t: 465217>, user.c, 376, Record key: 0x7010 0> <t: 465222>, user.c, 648, FDS Data is Writting ... 0> <t: 465278>, user.c, 332, Event: FDS_EVT_WRITE received (FDS_SUCCESS) 0> <t: 465281>, user.c, 348, Record ID: 0x0037 0> <t: 465283>, user.c, 349, File ID: 0xF010 0> <t: 465285>, user.c, 350, Record key: 0x7010 //================below: (FDS_ERR_OPERATION_TIMEOUT)=================// 0> <t: 460010>, access.c, 942, RX opcode =[FFFF8206] 0> <t: 460012>, access.c, 943, msg length =[0005] 0> <t: 460014>, access.c, 944, msg rx: : 5000181414 0> <t: 460017>, access.c, 952, element index =[0] 0> <t: 460019>, access.c, 1015, In coming is OK ! 0> <t: 460021>, generic_level_server.c, 101, Opcode Jumper to Level handl_set ! 0> <t: 460025>, app_level.c, 498, Level SET: Level: 80 delay: 100 tt: 2000 req-delta: -10 0> <t: 460029>, access.c, 284, appkey_handle is 65535 0> <t: 460032>, access.c, 285, address_handle is 0 0> <t: 460034>, access.c, 402, Source address: 9 Target Address: 4 0> <t: 460037>, access.c, 407, sensor msg tx: : 5A00500014 0> <t: 460046>, access.c, 972, is_opcode_of_model true 0> <t: 460048>, access.c, 983, address_match false 0> <t: 460050>, access.c, 988, bitfield_get true 0> <t: 460052>, access.c, 995, ACCESS_INTERNAL_STATE_IS_ALLOCATED true 0> <t: 463306>, app_level.c, 280, Selecting interval for one step change 0> <t: 463309>, app_level.c, 284, timeout_rtc_ticks: 6554 ticks 0> <t: 469866>, app_level.c, 303, delta= -10 0> <t: 469868>, app_level.c, 313, One Level cb happen ! 0> <t: 469870>, app_level.c, 314, Present Level: 90 0> <t: 469873>, app_level.c, 316, ELAPSED_TIME: 90 ,Transition Time: 0 0> <t: 469875>, main.c, 268, m_pwm0_present_level is: 90 0> <t: 469878>, main.c, 291, Pwm value: 9000 0> <t: 476434>, app_level.c, 303, delta= -10 0> <t: 476436>, app_level.c, 313, One Level cb happen ! 0> <t: 476438>, app_level.c, 314, Present Level: 89 0> <t: 476441>, app_level.c, 316, ELAPSED_TIME: 89 ,Transition Time: 200 0> <t: 476444>, main.c, 268, m_pwm0_present_level is: 89 0> <t: 476446>, main.c, 291, Pwm value: 8900 0> <t: 483003>, app_level.c, 303, delta= -10 0> <t: 483005>, app_level.c, 313, One Level cb happen ! 0> <t: 483008>, app_level.c, 314, Present Level: 88 0> <t: 483010>, app_level.c, 316, ELAPSED_TIME: 88 ,Transition Time: 400 0> <t: 483013>, main.c, 268, m_pwm0_present_level is: 88 0> <t: 483016>, main.c, 291, Pwm value: 8800 0> <t: 489572>, app_level.c, 303, delta= -10 0> <t: 489574>, app_level.c, 313, One Level cb happen ! 0> <t: 489576>, app_level.c, 314, Present Level: 87 0> <t: 489579>, app_level.c, 316, ELAPSED_TIME: 87 ,Transition Time: 601 0> <t: 489582>, main.c, 268, m_pwm0_present_level is: 87 0> <t: 489584>, main.c, 291, Pwm value: 8700 0> <t: 496141>, app_level.c, 303, delta= -10 0> <t: 496143>, app_level.c, 313, One Level cb happen ! 0> <t: 496145>, app_level.c, 314, Present Level: 86 0> <t: 496148>, app_level.c, 316, ELAPSED_TIME: 86 ,Transition Time: 801 0> <t: 496151>, main.c, 268, m_pwm0_present_level is: 86 0> <t: 496153>, main.c, 291, Pwm value: 8600 0> <t: 502710>, app_level.c, 303, delta= -10 0> <t: 502712>, app_level.c, 313, One Level cb happen ! 0> <t: 502714>, app_level.c, 314, Present Level: 85 0> <t: 502717>, app_level.c, 316, ELAPSED_TIME: 85 ,Transition Time: 1002 0> <t: 502720>, main.c, 268, m_pwm0_present_level is: 85 0> <t: 502722>, main.c, 291, Pwm value: 8500 0> <t: 509279>, app_level.c, 303, delta= -10 0> <t: 509281>, app_level.c, 313, One Level cb happen ! 0> <t: 509283>, app_level.c, 314, Present Level: 84 0> <t: 509286>, app_level.c, 316, ELAPSED_TIME: 84 ,Transition Time: 1202 0> <t: 509289>, main.c, 268, m_pwm0_present_level is: 84 0> <t: 509291>, main.c, 291, Pwm value: 8400 0> <t: 515848>, app_level.c, 303, delta= -10 0> <t: 515850>, app_level.c, 313, One Level cb happen ! 0> <t: 515852>, app_level.c, 314, Present Level: 83 0> <t: 515855>, app_level.c, 316, ELAPSED_TIME: 83 ,Transition Time: 1403 0> <t: 515858>, main.c, 268, m_pwm0_present_level is: 83 0> <t: 515860>, main.c, 291, Pwm value: 8300 0> <t: 522417>, app_level.c, 303, delta= -10 0> <t: 522419>, app_level.c, 313, One Level cb happen ! 0> <t: 522421>, app_level.c, 314, Present Level: 82 0> <t: 522424>, app_level.c, 316, ELAPSED_TIME: 82 ,Transition Time: 1603 0> <t: 522427>, main.c, 268, m_pwm0_present_level is: 82 0> <t: 522429>, main.c, 291, Pwm value: 8200 0> <t: 528986>, app_level.c, 303, delta= -10 0> <t: 528988>, app_level.c, 313, One Level cb happen ! 0> <t: 528990>, app_level.c, 314, Present Level: 81 0> <t: 528993>, app_level.c, 316, ELAPSED_TIME: 81 ,Transition Time: 1804 0> <t: 528996>, main.c, 268, m_pwm0_present_level is: 81 0> <t: 528998>, main.c, 291, Pwm value: 8100 0> <t: 535555>, access.c, 284, appkey_handle is 65535 0> <t: 535558>, access.c, 285, address_handle is 0 0> <t: 535560>, main.c, 268, m_pwm0_present_level is: 80 0> <t: 535563>, main.c, 291, Pwm value: 8000 0> <t: 535565>, app_level.c, 337, Level_transition_complete: 80 0> <t: 535568>, app_level.c, 340, pwm_value is 80 ,Flag is 1 0> <t: 535571>, user.c, 606, Is Coming to FDS! 0> <t: 535573>, user.c, 611, Element 0, value is 80! 0> <t: 535575>, user.c, 622, === Found 1 valid records. 0> <t: 535578>, user.c, 623, === Found 1 dirty records. 0> <t: 535580>, user.c, 431, delete_next: 1,pending_flag:0. 0> <t: 535583>, user.c, 436, Deleting next record. 0> <t: 535621>, user.c, 332, Event: FDS_EVT_DEL_RECORD received (FDS_ERR_OPERATION_TIMEOUT) 0> <t: 535626>, user.c, 414, Delete TRUE ! //=================== bellow : No working================================// 0> <t: 6268450>, access.c, 942, RX opcode =[FFFF8206] 0> <t: 6268453>, access.c, 943, msg length =[0005] 0> <t: 6268455>, access.c, 944, msg rx: : 0A00041414 0> <t: 6268458>, access.c, 952, element index =[0] 0> <t: 6268460>, access.c, 1015, In coming is OK ! 0> <t: 6268463>, generic_level_server.c, 101, Opcode Jumper to Level handl_set ! 0> <t: 6268466>, app_level.c, 498, Level SET: Level: 10 delay: 100 tt: 2000 req-delta: 10 0> <t: 6268471>, access.c, 284, appkey_handle is 65535 0> <t: 6268473>, access.c, 285, address_handle is 0 0> <t: 6268476>, access.c, 402, Source address: 9 Target Address: 4 0> <t: 6268479>, access.c, 407, sensor msg tx: : 00000A0014 0> <t: 6268488>, access.c, 972, is_opcode_of_model true 0> <t: 6268490>, access.c, 983, address_match false 0> <t: 6268492>, access.c, 988, bitfield_get true 0> <t: 6268494>, access.c, 995, ACCESS_INTERNAL_STATE_IS_ALLOCATED true 0> <t: 6271747>, app_level.c, 280, Selecting interval for one step change 0> <t: 6271750>, app_level.c, 284, timeout_rtc_ticks: 6554 ticks 0> <t: 6278307>, app_level.c, 303, delta= 10 0> <t: 6278309>, app_level.c, 313, One Level cb happen ! 0> <t: 6278312>, app_level.c, 314, Present Level: 0 0> <t: 6278314>, app_level.c, 316, ELAPSED_TIME: 0 ,Transition Time: 0 0> <t: 6278317>, main.c, 268, m_pwm0_present_level is: 0 0> <t: 6278319>, main.c, 291, Pwm value: 0 0> <t: 6284876>, app_level.c, 303, delta= 10 0> <t: 6284878>, app_level.c, 313, One Level cb happen ! 0> <t: 6284881>, app_level.c, 314, Present Level: 1 0> <t: 6284883>, app_level.c, 316, ELAPSED_TIME: 1 ,Transition Time: 200 0> <t: 6284886>, main.c, 268, m_pwm0_present_level is: 1 0> <t: 6284889>, main.c, 291, Pwm value: 100 0> <t: 6291445>, app_level.c, 303, delta= 10 0> <t: 6291447>, app_level.c, 313, One Level cb happen ! 0> <t: 6291450>, app_level.c, 314, Present Level: 2 0> <t: 6291452>, app_level.c, 316, ELAPSED_TIME: 2 ,Transition Time: 400 0> <t: 6291455>, main.c, 268, m_pwm0_present_level is: 2 0> <t: 6291458>, main.c, 291, Pwm value: 200 0> <t: 6298014>, app_level.c, 303, delta= 10 0> <t: 6298016>, app_level.c, 313, One Level cb happen ! 0> <t: 6298019>, app_level.c, 314, Present Level: 3 0> <t: 6298021>, app_level.c, 316, ELAPSED_TIME: 3 ,Transition Time: 601 0> <t: 6298024>, main.c, 268, m_pwm0_present_level is: 3 0> <t: 6298027>, main.c, 291, Pwm value: 300 0> <t: 6304583>, app_level.c, 303, delta= 10 0> <t: 6304585>, app_level.c, 313, One Level cb happen ! 0> <t: 6304588>, app_level.c, 314, Present Level: 4 0> <t: 6304590>, app_level.c, 316, ELAPSED_TIME: 4 ,Transition Time: 801 0> <t: 6304593>, main.c, 268, m_pwm0_present_level is: 4 0> <t: 6304596>, main.c, 291, Pwm value: 400 0> <t: 6311152>, app_level.c, 303, delta= 10 0> <t: 6311154>, app_level.c, 313, One Level cb happen ! 0> <t: 6311157>, app_level.c, 314, Present Level: 5 0> <t: 6311159>, app_level.c, 316, ELAPSED_TIME: 5 ,Transition Time: 1002 0> <t: 6311162>, main.c, 268, m_pwm0_present_level is: 5 0> <t: 6311165>, main.c, 291, Pwm value: 500 0> <t: 6317721>, app_level.c, 303, delta= 10 0> <t: 6317723>, app_level.c, 313, One Level cb happen ! 0> <t: 6317725>, app_level.c, 314, Present Level: 6 0> <t: 6317728>, app_level.c, 316, ELAPSED_TIME: 6 ,Transition Time: 1202 0> <t: 6317731>, main.c, 268, m_pwm0_present_level is: 6 0> <t: 6317734>, main.c, 291, Pwm value: 600 0> <t: 6324290>, app_level.c, 303, delta= 10 0> <t: 6324292>, app_level.c, 313, One Level cb happen ! 0> <t: 6324295>, app_level.c, 314, Present Level: 7 0> <t: 6324297>, app_level.c, 316, ELAPSED_TIME: 7 ,Transition Time: 1403 0> <t: 6324300>, main.c, 268, m_pwm0_present_level is: 7 0> <t: 6324303>, main.c, 291, Pwm value: 700 0> <t: 6330860>, app_level.c, 303, delta= 10 0> <t: 6330862>, app_level.c, 313, One Level cb happen ! 0> <t: 6330864>, app_level.c, 314, Present Level: 8 0> <t: 6330867>, app_level.c, 316, ELAPSED_TIME: 8 ,Transition Time: 1603 0> <t: 6330870>, main.c, 268, m_pwm0_present_level is: 8 0> <t: 6330873>, main.c, 291, Pwm value: 800 0> <t: 6331528>, access.c, 284, appkey_handle is 65535 0> <t: 6331531>, access.c, 285, address_handle is 65535 0> <t: 6337429>, app_level.c, 303, delta= 10 0> <t: 6337431>, app_level.c, 313, One Level cb happen ! 0> <t: 6337434>, app_level.c, 314, Present Level: 9 0> <t: 6337436>, app_level.c, 316, ELAPSED_TIME: 9 ,Transition Time: 1804 0> <t: 6337439>, main.c, 268, m_pwm0_present_level is: 9 0> <t: 6337442>, main.c, 291, Pwm value: 900 0> <t: 6343998>, access.c, 284, appkey_handle is 65535 0> <t: 6344001>, access.c, 285, address_handle is 0 0> <t: 6344003>, main.c, 268, m_pwm0_present_level is: 10 0> <t: 6344006>, main.c, 291, Pwm value: 1000 0> <t: 6344008>, app_level.c, 337, Level_transition_complete: 10 0> <t: 6344011>, app_level.c, 340, pwm_value is 10 ,Flag is 1
sometingtimes,FDS delete and write record data prefect right ,but once Event (FDS_ERR_OPERATION_TIMEOUT) happens, the FDS is no longer work except press reset button to restart.
The fllow is A part Code:
static void initialize(void) { ... fds_test(); } int main(void) { initialize(); ... for (;;) { fds_data(); (void)sd_app_evt_wait(); } } void fds_data(void) { //app_level_server_t * p_server; // __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"Waking !\n"); if(fds_flag==true) { __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"Is Coming to FDS!\n"); fds_flag=false; if(element_number==0) { m_dummy_cfg.pwm_value[0]=pwm_value;//p_server->state.present_level; __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"Element 0, value is %d!\n",m_dummy_cfg.pwm_value[0]); } else if(element_number==1) { m_dummy_cfg.pwm_value[1]=pwm_value;//p_server->state.present_level; __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"Element 1, value is %d!\n",m_dummy_cfg.pwm_value[1]); } fds_stat_t stat = {0}; ret_code_t rc = fds_stat(&stat); APP_ERROR_CHECK(rc); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"=== Found %d valid records.\n", stat.valid_records); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"=== Found %d dirty records.\n", stat.dirty_records); #if 0 if(stat.dirty_records>=3) { m_fds_gc=false; rc=fds_gc(); APP_ERROR_CHECK(rc); wait_for_fds_gc(); } #endif fds_record_desc_t desc = {0}; fds_find_token_t tok = {0}; rc = fds_record_find(CONFIG_FILE, CONFIG_REC_KEY, &desc, &tok); if (rc == FDS_SUCCESS) { m_fds_deleted=false; delete_all_begin(); delete_all_process(); wait_for_fds_delete(); } m_fds_write=false; rc = fds_record_write(&desc, &m_dummy_record); if(rc==FDS_SUCCESS) { __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"FDS Data is Writting ...\n"); } APP_ERROR_CHECK(rc); wait_for_fds_write(); // (void) sd_app_evt_wait(); } } void fds_test(void) //int main(void) { ret_code_t rc; __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "---FDS example started .---\n"); /* Register first to receive an event when initialization is complete. */ (void) fds_register(fds_evt_handler); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initializing fds...\n"); rc = fds_init(); APP_ERROR_CHECK(rc); /* Wait for fds to initialize. */ wait_for_fds_ready(); fds_stat_t stat = {0}; rc = fds_stat(&stat); APP_ERROR_CHECK(rc); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"Found %d valid records.\n", stat.valid_records); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"Found %d dirty records (ready to be garbage collected).\n", stat.dirty_records); fds_record_desc_t desc = {0}; fds_find_token_t tok = {0}; rc = fds_record_find(CONFIG_FILE, CONFIG_REC_KEY, &desc, &tok); if (rc == FDS_SUCCESS) { /* A config file is in flash. Let's update it. */ fds_flash_record_t config = {0}; /* Open the record and read its contents. */ rc = fds_record_open(&desc, &config); APP_ERROR_CHECK(rc); /* Copy the configuration from flash into m_dummy_cfg. */ memcpy(&m_dummy_cfg, config.p_data, sizeof(configuration_t)); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "PWM Value is %d and %d \r\n", m_dummy_cfg.pwm_value[0], m_dummy_cfg.pwm_value[1]); //add #if 0 uint32_t *data; __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"Data = "); data = (uint32_t *)config.p_data; for (uint16_t i=0;i<config.p_header->length_words;i++) { __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"0x%8x ",data[i]); } __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"\r\n"); #endif __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"Config file found, updating boot count to %d.\n", m_dummy_cfg.boot_count); /* Update boot count. */ m_dummy_cfg.boot_count++; /* Close the record when done reading. */ rc = fds_record_close(&desc); APP_ERROR_CHECK(rc); /* Write the updated record to flash. */ rc = fds_record_update(&desc, &m_dummy_record); APP_ERROR_CHECK(rc); if(stat.dirty_records>=3) { m_fds_gc=false; rc=fds_gc(); APP_ERROR_CHECK(rc); wait_for_fds_gc(); } } else { /* System config not found; write a new one. */ __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"Writing config file...\n"); m_dummy_cfg.pwm_value[0]=50; m_dummy_cfg.pwm_value[1]=40; m_fds_write=false; rc = fds_record_write(&desc, &m_dummy_record); APP_ERROR_CHECK(rc); wait_for_fds_write(); } }
The include file is here: include.rar
SDK:15.0.0 , Mesh SDK:2.2.0
How can slove this issue,Could anyone give me some help?thanks in advace.
Best Regards,
Panda.