/* ====================================================================== Function: decode_frame_type Purpose : print the frame type Input : type Output : string to decoded packet type name Comments: - ====================================================================== */ char * decode_frame_type(uint8_t type) { // check command type is known if (!isPayloadValid(type)) type =0; if (type == RF_PL_ALIVE ) strcpy_P(pbuf, PSTR("ALIVE")); else if (type == RF_PL_PING ) strcpy_P(pbuf, PSTR("PING")); else if (type == RF_PL_PINGBACK ) strcpy_P(pbuf, PSTR("PINGBACK")); else if (type == RF_PL_OTA_CONFIG ) strcpy_P(pbuf, PSTR("OTA_CONFIG")); else if (type == RF_PL_OTA_UPDATE ) strcpy_P(pbuf, PSTR("OTA_UPDATE")); else if (type == RF_PL_DHCP_REQUEST ) strcpy_P(pbuf, PSTR("DHCP_REQUEST")); else if (type == RF_PL_DHCP_OFFER ) strcpy_P(pbuf, PSTR("DHCP_OFFER")); else if (type == RF_PL_SENSOR_DATA ) strcpy_P(pbuf, PSTR("DATA")); else strcpy_P(pbuf, PSTR("UNKNOWN")); // I did not succeded to do better with array of flash string in Arduino //#if defined(ARDUINO) && !defined(ESP8266) // strcpy_P(pbuf, (char*)pgm_read_word(&(rf_frame[type]))); //#else // strcpy_P(pbuf, PSTR(rf_frame[type])); //#endif return pbuf; }
/* ====================================================================== Function: decode_frame_type Purpose : print the frame type Input : type Output : - Comments: - ====================================================================== */ char * decode_frame_type(uint8_t type) { // check command type is known if (!isPayloadValid(type)) type =0; #ifdef SPARK strcpy(pbuf, rf_frame[type]); #else strcpy(pbuf, (char*)pgm_read_word(&(rf_frame[type]))); #endif return pbuf; }