## Features - Light Strip Cutting

### Function Introduction
- Users can adjust the length of the light strip on the App to adjust the light display range.

### DP Protocol
- Adjust the length or number of light strips through the cooperation of multiple DPs.

|dpId | Meaning | dpCode | Report and send | Value type | Attribute | Remarks |
|---|---|---|---|---|---|---|
| 46 (dpid) | Light strip length (optional) | light_length|Report only (ro)| Numeric type (Value)| Value range: 1-10000, Spacing: 1, Multiple: 0, Unit: cm| Total length of the fantasy light strip displayed on the UI panel |
|47 | Light strip points (mandatory) | light_pixel |Report only (ro)| Numeric type (Value)| Value range: 1-1024, Spacing: 1, Multiple: 0|Total number of chips for the fantasy light strip driver|
|53|Point/length setting (optional)|lightpixel_number_set|Can be sent and reported (rw)|Numerical type (Value)|Numerical range: 1-1000, spacing: 1, multiple: 0|After the fantasy light strip is cut, the length is reset|

- [Light strip length] is an optional function. If this DP point is selected, the panel will display the light strip length setting content in length units (meters). If this DP point is not selected, the light strip point setting content will be displayed in points/quantity
- [Light strip points] is a mandatory function, indicating the total number of chips/total points of the device driver. This DP is only reported, and the panel can obtain the total number of device points through this DP point
- [Point/length setting] is an optional function. If this DP point is selected, the panel will display the light strip length setting section. Users can Adjust the length of the light strip to adjust the light display range; if this DP point is not selected, the panel will not display the light strip length setting content, and the user cannot make secondary settings

### How to develop
- Specific logic of cutting DP:
  - Both light_pixel and light_length dp exist
  - For the first network configuration, the initial data reported by light_pixel and lightpixel_number_set are the same
  - When setting the length of the panel, it is necessary to send lightpixel_number_set dp, which is actually the number of points
    - For example🌰:
      - light_length => 200cm === 2m
      - light_pixel => 100 means that there are 100 lamp beads on 2m
      - When setting the length, it needs to be converted to points and sent:
      - For example, if it is cut from the middle, the remaining length should be 1m
      - It is mainly needed in page display, and the number of lamp beads is used directly when sending
      - The sent value is: 50 corresponding to the number of lamp beads
      - Send the maximum and minimum limits:
        - `const max = lightPixel;`
        - `const min = 10;`
  - light_pixel dp exists, light_length dp does not exist
    - For the first network configuration, the initial data reported by light_pixel and lightpixel_number_set are the same
    - When the panel sets the length, it is necessary to send lightpixel_number_set dp, which is actually the number of points
    - For example:
      - light_pixel => 100 means that the light strip has 100 lamp beads
      - Send the corresponding lamp bead data directly
      - Send the maximum and minimum limits:
      - `const max = lightPixel;`
      - `const min = 10;`

- Refer to the DP operation above and send the corresponding DP value directly.
- Note that the number of lamp beads sent by DP corresponds to lightpixel_number_set dp.
  - [Specific monitoring and sending examples](/en/miniapp/solution-panel/ability#device-function-point-management)

### Notes
- After the device is cut and saved, the RGB mixed light state of the cut will be restored to the previous running state
- Just need to re-send the setting work_mode
```js
// Restore workMode when exiting
const workModeCode = 'work_mode';
useUnmount(() => {
  dragon.putDpData({ [workModeCode]: workMode }, { checkCurrent: false});
});
```
### Related materials
- [Function page]:
  1. [Lamp strip cutting function page](https://developer.tuya.com/material/library_oHEKLjj0/component?code=LampStripClipFunctional)
- [Component]: 
  - None
- [Tutorial]: 
  - None
- [SDK]: 
  - None
- [API]: 
  - None