![]() Initialize storage: Initialize the memory address of each data storage ID. OPERATE_RET ty_light_save_flash_init(VOID_T) STATIC UINT32_T flash_rw_original_addr = LIGHT_CTRL_DATA_FLASH_ADDR1 + FLASH_HEAD_SIZE //Initial storage address STATIC UINT8_T total_id_num //Total number of IDs Global variables DATA_ID_INFO_T data_id_offset //ID data cacheĭATA_FLASH_RW_OFFSET_T data_flash_rw_offset //Read/write the cache address } DATA_FLASH_RW_OFFSET_T //Read/write the cache address } DATA_ID_INFO_T //ID cache typedef struct ![]() UINT32_T offset //ID data storage address *ty_light_save_user_flash.c*/ typedef struct The NV component stores and maintains the scene data. }LIGHT_FLASH_SAVE_ID_E // Three IDs are used for: reset, light data, and scene information. Structs /*ty_light_save_user_flash.h*/ typedef enum *ty_light_save_user_flash.c*/ # define FLASH_WRITE_SIZE 4000 //The size of a block is 4 KB, with 96 bytes reserved. # define FLASH_WRITE_DATA_MAX_LEN 100 // Up to 100 bytes can be stored at a time, with 4-byte alignment. Macro definition /*ty_light_save_user_flash.h*/ # define LIGHT_CTRL_DATA_FLASH_ADDR1 0x7D000 // 0x45000 for Telink and Phyplus # define LIGHT_CTRL_DATA_FLASH_ADDR2 0x7E000 // 0x46000 for Telink and Phyplus # define ID_NUM_MAX 3 // Currently, the system can store data for up to three IDs. To enable log printing, set the macro ENABLE_FLASH_RW_LOG to 1. To add an ID, edit the macro ID_NUM_MAX and include the ID in the struct LIGHT_FLASH_SAVE_ID_E. You can store up to three IDs by default. It is 4-byte aligned and contains a 4-byte cyclic redundancy check (CRC) value. The data is stored incrementally in two blocks alternately. # define ENABLE_APP_LOG 1 ty_light_save_user_flash.c In the production stage, set ENABLE_APP_LOG to 0 for authorization. If the transmission rate is slow due to a large volume of log output, the device might restart. The serial port baud rate for authorization defaults to 9600 and can be set to 115200 for log printing. ![]() To enable logging, modify the settings in tal_log.h. Application logic app_common.cīy default, logging is disabled in app_common.c and other components. To adjust the maximum and minimum brightness and power scale, right-click your project and choose Config Project in Tuya Wind IDE. You can add the required driver as needed. ![]() The standard protocol allows for group-based sync of lighting scenes.Īpp_common.c includes example of using components.The white and color light is adjusted by PWM.If no operation is performed within six minutes, the device restores to the previous network state. Repeating the on/off cycle five times can reset the device.The LED blinks every 500 ms for 6 minutes to indicate the pairing state.Implement the basic features for a lighting product. This topic describes the features provided by the Bluetooth Mesh Lighting Product Development Kit (TLSR825x). ![]()
0 Comments
Leave a Reply. |