From e78a0806f5354563c0c975c81b3d90ea863b185f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=85=95=E7=82=8E?= <29385962@qq.com> Date: Sat, 1 Jan 2022 11:47:29 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20arduino/?= =?UTF-8?q?Betas/RGB=5FV1.1.1/Command.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arduino/Betas/RGB_V1.1.1/Command.cpp | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 arduino/Betas/RGB_V1.1.1/Command.cpp diff --git a/arduino/Betas/RGB_V1.1.1/Command.cpp b/arduino/Betas/RGB_V1.1.1/Command.cpp deleted file mode 100644 index 323d99a..0000000 --- a/arduino/Betas/RGB_V1.1.1/Command.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "Command.h" - -void Command::run(char* str){ - for(int i=0; i < call_count; i++){ - if(isSentinel(call_ids[i],str)){ // case : call_ids = "T2" str = "T215.15" - call_list[i](str+strlen(call_ids[i])); // get 15.15 input function - break; - } - } -} -void Command::add(char* id, CommandCallback onCommand){ - call_list[call_count] = onCommand; - call_ids[call_count] = id; - call_count++; -} -void Command::scalar(float* value, char* user_cmd){ - *value = atof(user_cmd); -} -bool Command::isSentinel(char* ch,char* str) -{ - char s[strlen(ch)+1]; - strncpy(s,str,strlen(ch)); - s[strlen(ch)] = '\0'; //strncpy need add end '\0' - if(strcmp(ch, s) == 0) - return true; - else - return false; -}