ESP8266: NodeMCU Development Kit

Test post 2

Heading 1

This is a Heading H2

This is a Heading H3

kokdhf djidj hỗ trợ tiếng Việt fjij jij jdij dji ljlasd ojf paojd pojsd kpld kpasd kfod ojasd okd oksd op aosk oksd oks aof pfuopdnpqokf qpoh[q qpokqd podkqp pkdq pokddq pokd pokqk p pokdqdj pqodk. okqdnoqdd poqdq oqkd pqdd np pqdnq pqmq pqqndo pqdn p.

dkofjokdf dji djijd jod jod jodj ojd ijij joijdw jijd dkowd kodkw o k pkpokd okw dojd okdwkd okokwd opkokd plpdijd okdjid okdnd pldjd.

2. Không gian trong này

kookdj jijed joed kokqd odkkq okokd okok okoked okokd okd okede okokd okokde okokd okokdel.

kokd jiejd okgd jojd okd okd okk okd okkd okokd jijfj jijd ijjg jijd jjdgjhd jihgd oasd jije ijed jd ijid ijjd ijdpod okok okoked okokd ihiyf ojig ijijd okok okd oke okd okad ojod okod ojd fygddk okoed okd okd yigpoj pokohgd pojou.

koksdg ijief iojidh randomnerdtutorials.com

mkokf jokd ijf textHightliter thể được sử dụng.

kokdjijijfjiijijf ujij ijied okokpkd okdkije ijijed ijf ijied 

okoedh ijed ijwd ijd ijdijd 

/*
  xsns_120_zakorgb_tube_v1.ino - Led RGB in glass tube for tanning, tasmota

  Project Start: 2022-Dec-12
  Author: PhuongXV - nguyennhatphuong88@gmail.com
*/
#define USE_ZAKORGB_TUBE_V1 1
#ifdef USE_ZAKORGB_TUBE_V1
#define XSNS_120                         120
/*----------------------Function My_LightColorEntry()---------------------*/
/*
* Copy from LightColorEntry() of Light module (xdrv_04)
* Return entry_type:
*0: Invalid entry
*1: Hexadecimal entry
*2: Decimal entry
*Put data to Light.entry_color; Light.wheel; Light.fixed_color_index = value; 
*/
bool My_LightColorEntry(char *buffer, uint32_t buffer_length)
{
  char scolor[10];
  char *p;
  char *str;
  uint32_t entry_type = 0;                          // Invalid
  uint8_t value = Light.fixed_color_index;

  
#ifdef USE_LIGHT_PALETTE
  if (Light.palette_count) value = Light.wheel;
#endif  // USE_LIGHT_PALETTE

  if (buffer[0] == '#') {                           // Optional hexadecimal entry
    buffer++;
    buffer_length--;
  }

  if (Light.subtype >= LST_RGB) {
    char option = (1 == buffer_length) ? buffer[0] : '\0';
    if ('+' == option) {
#ifdef USE_LIGHT_PALETTE
      if (Light.palette_count || Light.fixed_color_index < MAX_FIXED_COLOR) {
#else // USE_LIGHT_PALETTE
      if (Light.fixed_color_index < MAX_FIXED_COLOR) {
#endif  // !USE_LIGHT_PALETTE
        value++;
      }
    }
    else if ('-' == option) {
#ifdef USE_LIGHT_PALETTE
      if (Light.palette_count || Light.fixed_color_index > 1) {
#else // USE_LIGHT_PALETTE
      if (Light.fixed_color_index > 1) {
#endif  // !USE_LIGHT_PALETTE
        value--;
      }
    } else {
      value = atoi(buffer);
    }
#ifdef USE_LIGHT_PALETTE
    if (Light.palette_count) value = value % Light.palette_count;
#endif  // USE_LIGHT_PALETTE
  }

  memset(&Light.entry_color, 0x00, sizeof(Light.entry_color));
  // erase all channels except if the last character is '=', #6799
  while ((buffer_length > 0) && ('=' == buffer[buffer_length - 1])) {
    buffer_length--;  // remove all trailing '='
    memcpy(&Light.entry_color, &Light.current_color, sizeof(Light.entry_color));
  }
  if (strchr(buffer, ',') != nullptr) {             // Decimal entry
    int8_t i = 0;
    for (str = strtok_r(buffer, ",", &p); str && i < 6; str = strtok_r(nullptr, ",", &p)) {
      if (i < LST_MAX) {
        Light.entry_color[i++] = atoi(str);
      }
    }
    entry_type = 2;                                 // Decimal
  }
  else if (((2 * Light.subtype) == buffer_length) || (buffer_length > 3)) {  // Hexadecimal entry
    for (uint32_t i = 0; i < tmin((uint)(buffer_length / 2), sizeof(Light.entry_color)); i++) {
      strlcpy(scolor, buffer + (i *2), 3);
      Light.entry_color[i] = (uint8_t)strtol(scolor, &p, 16);
    }
    entry_type = 1;                                 // Hexadecimal
  }
#ifdef USE_LIGHT_PALETTE
  else if (Light.palette_count) {
    Light.wheel = value;
    memcpy_P(&Light.entry_color, &Light.palette[value * Light.subtype], Light.subtype);
    entry_type = 1;                                 // Hexadecimal
  }
#endif  // USE_LIGHT_PALETTE
  else if ((Light.subtype >= LST_RGB) && (value > 0) && (value <= MAX_FIXED_COLOR)) {
    Light.fixed_color_index = value;
    memcpy_P(&Light.entry_color, &kFixedColor[value -1], 3);
    entry_type = 1;                                 // Hexadecimal
  }
  else if ((value > 199) && (value <= 199 + MAX_FIXED_COLD_WARM)) {
    if (LST_RGBW == Light.subtype) {
      memcpy_P(&Light.entry_color[3], &kFixedWhite[value -200], 1);
      entry_type = 1;                               // Hexadecimal
    }
    else if (LST_COLDWARM == Light.subtype) {
      memcpy_P(&Light.entry_color, &kFixedColdWarm[value -200], 2);
      entry_type = 1;                               // Hexadecimal
    }
    else if (LST_RGBCW == Light.subtype) {
      memcpy_P(&Light.entry_color[3], &kFixedColdWarm[value -200], 2);
      entry_type = 1;                               // Hexadecimal
    }
  }
//  Too much magic so removed since 9.0.0.3
//  if (entry_type) {
//    Settings->flag.decimal_text = entry_type -1;     // SetOption17 - Switch between decimal or hexadecimal output
//  }

  return (entry_type);
} //-----------------end My_LightColorEntry()-------------------


/*********************************************************************************************\
 * Interface
\*********************************************************************************************/

bool Xsns120(uint32_t function) {
  bool result = false;
    switch (function) {
      case FUNC_INIT:
        ;
        break;
      case FUNC_LOOP:
        ;
        break;
      case FUNC_SLEEP_LOOP:
        ;       
        break;
      case FUNC_EVERY_100_MSECOND:
        ;       
        break;
      case FUNC_EVERY_SECOND:       
        AddLogData(LOG_LEVEL_INFO, "Xsns120 every 1sec");
        break;
      case FUNC_JSON_APPEND:
        ;        
        break;
#ifdef USE_WEBSERVER
      case FUNC_WEB_SENSOR:        
        break;
#endif  // USE_WEBSERVER
      case FUNC_COMMAND:        
        break;
    }  
  return result;
}

#endif  // USE_LD2410

#ifdef USE_WEBSERVER
      case FUNC_WEB_SENSOR:        
        break;
#endif  // USE_WEBSERVER
#Comment in python
def MyFunction():
#kokok jojf oasjd oasdd oasd osod oio oksd oaksd osodka oasdka okkds okaoskd okoskda okaoskd okokasd okoaksd fokodk okosakd okoked oksokd okeok oaksdsd okeoke okoskd oekoked okokd oaskdokad
return
bool Xsns120(uint32_t function) {
  bool result = false;
    switch (function) {
      case FUNC_INIT:
        ;
        break;
      case FUNC_LOOP:
        ;
        break;
      case FUNC_SLEEP_LOOP:
        ;       
        break;
      case FUNC_EVERY_100_MSECOND:
        ;       
        break;
      case FUNC_EVERY_SECOND:       
        AddLogData(LOG_LEVEL_INFO, "Xsns120 every 1sec");
        break;
      case FUNC_JSON_APPEND:
        ;        
        break;
#ifdef USE_WEBSERVER
      case FUNC_WEB_SENSOR:        
        break;
#endif  // USE_WEBSERVER
      case FUNC_COMMAND:        
        break;
    }  
  return result;
}

Viết một bình luận