mirror of
https://github.com/arendst/Tasmota.git
synced 2025-08-02 07:27:42 +00:00
Refactor commands
Refactor commands
This commit is contained in:
parent
01ca5f5cfb
commit
305cb8fd7e
@ -32,6 +32,10 @@
|
|||||||
#define D_JSON_RF_PULSE "Pulse"
|
#define D_JSON_RF_PULSE "Pulse"
|
||||||
#define D_JSON_RF_REPEAT "Repeat"
|
#define D_JSON_RF_REPEAT "Repeat"
|
||||||
|
|
||||||
|
const char kRfSendCommands[] PROGMEM = D_CMND_RFSEND;
|
||||||
|
|
||||||
|
void (* const RfSendCommand[])(void) PROGMEM = { &CmndRfSend };
|
||||||
|
|
||||||
#include <RCSwitch.h>
|
#include <RCSwitch.h>
|
||||||
|
|
||||||
RCSwitch mySwitch = RCSwitch();
|
RCSwitch mySwitch = RCSwitch();
|
||||||
@ -87,12 +91,10 @@ void RfInit(void)
|
|||||||
* Commands
|
* Commands
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
bool RfSendCommand(void)
|
void CmndRfSend(void)
|
||||||
{
|
{
|
||||||
bool serviced = true;
|
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
|
||||||
if (!strcasecmp_P(XdrvMailbox.topic, PSTR(D_CMND_RFSEND))) {
|
|
||||||
if (XdrvMailbox.data_len) {
|
if (XdrvMailbox.data_len) {
|
||||||
unsigned long data = 0;
|
unsigned long data = 0;
|
||||||
unsigned int bits = 24;
|
unsigned int bits = 24;
|
||||||
@ -145,7 +147,7 @@ bool RfSendCommand(void)
|
|||||||
if (!bits) { bits = 24; } // Default 24 bits
|
if (!bits) { bits = 24; } // Default 24 bits
|
||||||
if (data) {
|
if (data) {
|
||||||
mySwitch.send(data, bits);
|
mySwitch.send(data, bits);
|
||||||
Response_P(PSTR("{\"" D_CMND_RFSEND "\":\"" D_JSON_DONE "\"}"));
|
ResponseCmndDone();
|
||||||
} else {
|
} else {
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
@ -156,10 +158,6 @@ bool RfSendCommand(void)
|
|||||||
Response_P(PSTR("{\"" D_CMND_RFSEND "\":\"" D_JSON_NO " " D_JSON_RF_DATA ", " D_JSON_RF_BITS ", " D_JSON_RF_PROTOCOL ", " D_JSON_RF_REPEAT " " D_JSON_OR " " D_JSON_RF_PULSE "\"}"));
|
Response_P(PSTR("{\"" D_CMND_RFSEND "\":\"" D_JSON_NO " " D_JSON_RF_DATA ", " D_JSON_RF_BITS ", " D_JSON_RF_PROTOCOL ", " D_JSON_RF_REPEAT " " D_JSON_OR " " D_JSON_RF_PULSE "\"}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else serviced = false; // Unknown command
|
|
||||||
|
|
||||||
return serviced;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Interface
|
* Interface
|
||||||
@ -171,9 +169,6 @@ bool Xdrv17(uint8_t function)
|
|||||||
|
|
||||||
if ((pin[GPIO_RFSEND] < 99) || (pin[GPIO_RFRECV] < 99)) {
|
if ((pin[GPIO_RFSEND] < 99) || (pin[GPIO_RFRECV] < 99)) {
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case FUNC_INIT:
|
|
||||||
RfInit();
|
|
||||||
break;
|
|
||||||
case FUNC_EVERY_50_MSECOND:
|
case FUNC_EVERY_50_MSECOND:
|
||||||
if (pin[GPIO_RFRECV] < 99) {
|
if (pin[GPIO_RFRECV] < 99) {
|
||||||
RfReceiveCheck();
|
RfReceiveCheck();
|
||||||
@ -181,9 +176,12 @@ bool Xdrv17(uint8_t function)
|
|||||||
break;
|
break;
|
||||||
case FUNC_COMMAND:
|
case FUNC_COMMAND:
|
||||||
if (pin[GPIO_RFSEND] < 99) {
|
if (pin[GPIO_RFSEND] < 99) {
|
||||||
result = RfSendCommand();
|
result = DecodeCommand(kRfSendCommands, RfSendCommand);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case FUNC_INIT:
|
||||||
|
RfInit();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -30,6 +30,10 @@ const uint8_t kIFan02Speed[MAX_FAN_SPEED] = { 0x00, 0x01, 0x03, 0x05 };
|
|||||||
const uint8_t kIFan03Speed[MAX_FAN_SPEED +2] = { 0x00, 0x01, 0x03, 0x04, 0x05, 0x06 };
|
const uint8_t kIFan03Speed[MAX_FAN_SPEED +2] = { 0x00, 0x01, 0x03, 0x04, 0x05, 0x06 };
|
||||||
const uint8_t kIFan03Sequence[MAX_FAN_SPEED][MAX_FAN_SPEED] = {{0, 2, 2, 2}, {0, 1, 2, 4}, {1, 1, 2, 5}, {4, 4, 5, 3}};
|
const uint8_t kIFan03Sequence[MAX_FAN_SPEED][MAX_FAN_SPEED] = {{0, 2, 2, 2}, {0, 1, 2, 4}, {1, 1, 2, 5}, {4, 4, 5, 3}};
|
||||||
|
|
||||||
|
const char kSonoffIfanCommands[] PROGMEM = D_CMND_FANSPEED;
|
||||||
|
|
||||||
|
void (* const SonoffIfanCommand[])(void) PROGMEM = { &CmndFanspeed };
|
||||||
|
|
||||||
uint8_t ifan_fanspeed_timer = 0;
|
uint8_t ifan_fanspeed_timer = 0;
|
||||||
uint8_t ifan_fanspeed_goal = 0;
|
uint8_t ifan_fanspeed_goal = 0;
|
||||||
bool ifan_receive_flag = false;
|
bool ifan_receive_flag = false;
|
||||||
@ -184,18 +188,8 @@ bool SonoffIfanSerialInput(void)
|
|||||||
* Commands
|
* Commands
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
enum SonoffIfanCommands { CMND_FANSPEED };
|
void CmndFanspeed(void)
|
||||||
const char kSonoffIfanCommands[] PROGMEM = D_CMND_FANSPEED;
|
|
||||||
|
|
||||||
bool SonoffIfanCommand(void)
|
|
||||||
{
|
{
|
||||||
bool serviced = true;
|
|
||||||
|
|
||||||
int command_code = GetCommandCode(XdrvMailbox.command, CMDSZ, XdrvMailbox.topic, kSonoffIfanCommands);
|
|
||||||
if (-1 == command_code) {
|
|
||||||
serviced = false; // Unknown command
|
|
||||||
}
|
|
||||||
else if (CMND_FANSPEED == command_code) {
|
|
||||||
if (XdrvMailbox.data_len > 0) {
|
if (XdrvMailbox.data_len > 0) {
|
||||||
if ('-' == XdrvMailbox.data[0]) {
|
if ('-' == XdrvMailbox.data[0]) {
|
||||||
XdrvMailbox.payload = (int16_t)GetFanspeed() -1;
|
XdrvMailbox.payload = (int16_t)GetFanspeed() -1;
|
||||||
@ -210,9 +204,6 @@ bool SonoffIfanCommand(void)
|
|||||||
SonoffIFanSetFanspeed(XdrvMailbox.payload, true);
|
SonoffIFanSetFanspeed(XdrvMailbox.payload, true);
|
||||||
}
|
}
|
||||||
ResponseCmndNumber(GetFanspeed());
|
ResponseCmndNumber(GetFanspeed());
|
||||||
} else serviced = false; // Unknown command
|
|
||||||
|
|
||||||
return serviced;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
@ -262,7 +253,7 @@ bool Xdrv22(uint8_t function)
|
|||||||
result = SonoffIfanSerialInput();
|
result = SonoffIfanSerialInput();
|
||||||
break;
|
break;
|
||||||
case FUNC_COMMAND:
|
case FUNC_COMMAND:
|
||||||
result = SonoffIfanCommand();
|
result = DecodeCommand(kSonoffIfanCommands, SonoffIfanCommand);
|
||||||
break;
|
break;
|
||||||
case FUNC_MODULE_INIT:
|
case FUNC_MODULE_INIT:
|
||||||
result = SonoffIfanInit();
|
result = SonoffIfanInit();
|
||||||
|
@ -24,6 +24,10 @@
|
|||||||
|
|
||||||
#define XSNS_01 1
|
#define XSNS_01 1
|
||||||
|
|
||||||
|
const char kCounterCommands[] PROGMEM = D_CMND_COUNTER "|" D_CMND_COUNTERTYPE "|" D_CMND_COUNTERDEBOUNCE ;
|
||||||
|
|
||||||
|
void (* const CounterCommand[])(void) PROGMEM = { &CmndCounter, &CmndCounterType, &CmndCounterDebounce };
|
||||||
|
|
||||||
unsigned long last_counter_timer[MAX_COUNTERS]; // Last counter time in micro seconds
|
unsigned long last_counter_timer[MAX_COUNTERS]; // Last counter time in micro seconds
|
||||||
|
|
||||||
#ifndef ARDUINO_ESP8266_RELEASE_2_3_0 // Fix core 2.5.x ISR not in IRAM Exception
|
#ifndef ARDUINO_ESP8266_RELEASE_2_3_0 // Fix core 2.5.x ISR not in IRAM Exception
|
||||||
@ -93,17 +97,10 @@ void CounterInit(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_WEBSERVER
|
|
||||||
const char HTTP_SNS_COUNTER[] PROGMEM =
|
|
||||||
"{s}" D_COUNTER "%d{m}%s%s{e}"; // {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
|
|
||||||
#endif // USE_WEBSERVER
|
|
||||||
|
|
||||||
void CounterShow(bool json)
|
void CounterShow(bool json)
|
||||||
{
|
{
|
||||||
char stemp[10];
|
bool header = false;
|
||||||
|
|
||||||
uint8_t dsxflg = 0;
|
uint8_t dsxflg = 0;
|
||||||
uint8_t header = 0;
|
|
||||||
for (uint32_t i = 0; i < MAX_COUNTERS; i++) {
|
for (uint32_t i = 0; i < MAX_COUNTERS; i++) {
|
||||||
if (pin[GPIO_CNTR1 +i] < 99) {
|
if (pin[GPIO_CNTR1 +i] < 99) {
|
||||||
char counter[33];
|
char counter[33];
|
||||||
@ -117,11 +114,9 @@ void CounterShow(bool json)
|
|||||||
if (json) {
|
if (json) {
|
||||||
if (!header) {
|
if (!header) {
|
||||||
ResponseAppend_P(PSTR(",\"COUNTER\":{"));
|
ResponseAppend_P(PSTR(",\"COUNTER\":{"));
|
||||||
stemp[0] = '\0';
|
|
||||||
}
|
}
|
||||||
header++;
|
ResponseAppend_P(PSTR("%s\"C%d\":%s"), (header)?",":"", i +1, counter);
|
||||||
ResponseAppend_P(PSTR("%s\"C%d\":%s"), stemp, i +1, counter);
|
header = true;
|
||||||
strlcpy(stemp, ",", sizeof(stemp));
|
|
||||||
#ifdef USE_DOMOTICZ
|
#ifdef USE_DOMOTICZ
|
||||||
if ((0 == tele_period) && (1 == dsxflg)) {
|
if ((0 == tele_period) && (1 == dsxflg)) {
|
||||||
DomoticzSensor(DZ_COUNT, RtcSettings.pulse_counter[i]);
|
DomoticzSensor(DZ_COUNT, RtcSettings.pulse_counter[i]);
|
||||||
@ -130,7 +125,8 @@ void CounterShow(bool json)
|
|||||||
#endif // USE_DOMOTICZ
|
#endif // USE_DOMOTICZ
|
||||||
#ifdef USE_WEBSERVER
|
#ifdef USE_WEBSERVER
|
||||||
} else {
|
} else {
|
||||||
WSContentSend_PD(HTTP_SNS_COUNTER, i +1, counter, (bitRead(Settings.pulse_counter_type, i)) ? " " D_UNIT_SECOND : "");
|
WSContentSend_PD(PSTR("{s}" D_COUNTER "%d{m}%s%s{e}"),
|
||||||
|
i +1, counter, (bitRead(Settings.pulse_counter_type, i)) ? " " D_UNIT_SECOND : "");
|
||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,26 +134,17 @@ void CounterShow(bool json)
|
|||||||
RtcSettings.pulse_counter[i] = 0xFFFFFFFF; // Set Timer to max in case of no more interrupts due to stall of measured device
|
RtcSettings.pulse_counter[i] = 0xFFFFFFFF; // Set Timer to max in case of no more interrupts due to stall of measured device
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (json) {
|
|
||||||
if (header) {
|
if (header) {
|
||||||
ResponseJsonEnd();
|
ResponseJsonEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Commands
|
* Commands
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
enum CounterCommands { CMND_COUNTER, CMND_COUNTERTYPE, CMND_COUNTERDEBOUNCE };
|
void CmndCounter(void)
|
||||||
const char kCounterCommands[] PROGMEM = D_CMND_COUNTER "|" D_CMND_COUNTERTYPE "|" D_CMND_COUNTERDEBOUNCE ;
|
|
||||||
|
|
||||||
bool CounterCommand(void)
|
|
||||||
{
|
{
|
||||||
bool serviced = true;
|
|
||||||
|
|
||||||
int command_code = GetCommandCode(XdrvMailbox.command, CMDSZ, XdrvMailbox.topic, kCounterCommands);
|
|
||||||
if (CMND_COUNTER == command_code) {
|
|
||||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_COUNTERS)) {
|
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_COUNTERS)) {
|
||||||
if ((XdrvMailbox.data_len > 0) && (pin[GPIO_CNTR1 + XdrvMailbox.index -1] < 99)) {
|
if ((XdrvMailbox.data_len > 0) && (pin[GPIO_CNTR1 + XdrvMailbox.index -1] < 99)) {
|
||||||
if ((XdrvMailbox.data[0] == '-') || (XdrvMailbox.data[0] == '+')) {
|
if ((XdrvMailbox.data[0] == '-') || (XdrvMailbox.data[0] == '+')) {
|
||||||
@ -171,7 +158,9 @@ bool CounterCommand(void)
|
|||||||
Response_P(S_JSON_COMMAND_INDEX_LVALUE, XdrvMailbox.command, XdrvMailbox.index, RtcSettings.pulse_counter[XdrvMailbox.index -1]);
|
Response_P(S_JSON_COMMAND_INDEX_LVALUE, XdrvMailbox.command, XdrvMailbox.index, RtcSettings.pulse_counter[XdrvMailbox.index -1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CMND_COUNTERTYPE == command_code) {
|
|
||||||
|
void CmndCounterType(void)
|
||||||
|
{
|
||||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_COUNTERS)) {
|
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_COUNTERS)) {
|
||||||
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1) && (pin[GPIO_CNTR1 + XdrvMailbox.index -1] < 99)) {
|
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1) && (pin[GPIO_CNTR1 + XdrvMailbox.index -1] < 99)) {
|
||||||
bitWrite(Settings.pulse_counter_type, XdrvMailbox.index -1, XdrvMailbox.payload &1);
|
bitWrite(Settings.pulse_counter_type, XdrvMailbox.index -1, XdrvMailbox.payload &1);
|
||||||
@ -181,16 +170,14 @@ bool CounterCommand(void)
|
|||||||
ResponseCmndIdxNumber(bitRead(Settings.pulse_counter_type, XdrvMailbox.index -1));
|
ResponseCmndIdxNumber(bitRead(Settings.pulse_counter_type, XdrvMailbox.index -1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CMND_COUNTERDEBOUNCE == command_code) {
|
|
||||||
|
void CmndCounterDebounce(void)
|
||||||
|
{
|
||||||
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 32001)) {
|
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 32001)) {
|
||||||
Settings.pulse_counter_debounce = XdrvMailbox.payload;
|
Settings.pulse_counter_debounce = XdrvMailbox.payload;
|
||||||
}
|
}
|
||||||
ResponseCmndNumber(Settings.pulse_counter_debounce);
|
ResponseCmndNumber(Settings.pulse_counter_debounce);
|
||||||
}
|
}
|
||||||
else serviced = false; // Unknown command
|
|
||||||
|
|
||||||
return serviced;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Interface
|
* Interface
|
||||||
@ -201,9 +188,6 @@ bool Xsns01(uint8_t function)
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case FUNC_INIT:
|
|
||||||
CounterInit();
|
|
||||||
break;
|
|
||||||
case FUNC_JSON_APPEND:
|
case FUNC_JSON_APPEND:
|
||||||
CounterShow(1);
|
CounterShow(1);
|
||||||
break;
|
break;
|
||||||
@ -217,7 +201,10 @@ bool Xsns01(uint8_t function)
|
|||||||
CounterSaveState();
|
CounterSaveState();
|
||||||
break;
|
break;
|
||||||
case FUNC_COMMAND:
|
case FUNC_COMMAND:
|
||||||
result = CounterCommand();
|
result = DecodeCommand(kCounterCommands, CounterCommand);
|
||||||
|
break;
|
||||||
|
case FUNC_INIT:
|
||||||
|
CounterInit();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -183,16 +183,12 @@ void AdcShow(bool json)
|
|||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
|
||||||
#define D_CMND_ADCPARAM "AdcParam"
|
#define D_CMND_ADCPARAM "AdcParam"
|
||||||
enum AdcCommands { CMND_ADC, CMND_ADCS, CMND_ADCPARAM };
|
|
||||||
const char kAdcCommands[] PROGMEM = D_CMND_ADC "|" D_CMND_ADCS "|" D_CMND_ADCPARAM;
|
const char kAdcCommands[] PROGMEM = D_CMND_ADC "|" D_CMND_ADCS "|" D_CMND_ADCPARAM;
|
||||||
|
|
||||||
bool AdcCommand(void)
|
void (* const AdcCommand[])(void) PROGMEM = { &CmndAdc, &CmndAdcs, &CmndAdcParam };
|
||||||
{
|
|
||||||
char command[CMDSZ];
|
|
||||||
bool serviced = true;
|
|
||||||
|
|
||||||
int command_code = GetCommandCode(command, sizeof(command), XdrvMailbox.topic, kAdcCommands);
|
void CmndAdc(void)
|
||||||
if (CMND_ADC == command_code) {
|
{
|
||||||
if (ValidAdc() && (XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < ADC0_END)) {
|
if (ValidAdc() && (XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < ADC0_END)) {
|
||||||
Settings.my_adc0 = XdrvMailbox.payload;
|
Settings.my_adc0 = XdrvMailbox.payload;
|
||||||
restart_flag = 2;
|
restart_flag = 2;
|
||||||
@ -200,7 +196,9 @@ bool AdcCommand(void)
|
|||||||
char stemp1[TOPSZ];
|
char stemp1[TOPSZ];
|
||||||
Response_P(PSTR("{\"" D_CMND_ADC "0\":\"%d (%s)\"}"), Settings.my_adc0, GetTextIndexed(stemp1, sizeof(stemp1), Settings.my_adc0, kAdc0Names));
|
Response_P(PSTR("{\"" D_CMND_ADC "0\":\"%d (%s)\"}"), Settings.my_adc0, GetTextIndexed(stemp1, sizeof(stemp1), Settings.my_adc0, kAdc0Names));
|
||||||
}
|
}
|
||||||
else if (CMND_ADCS == command_code) {
|
|
||||||
|
void CmndAdcs(void)
|
||||||
|
{
|
||||||
Response_P(PSTR("{\"" D_CMND_ADCS "\":["));
|
Response_P(PSTR("{\"" D_CMND_ADCS "\":["));
|
||||||
bool jsflg = false;
|
bool jsflg = false;
|
||||||
char stemp1[TOPSZ];
|
char stemp1[TOPSZ];
|
||||||
@ -213,7 +211,9 @@ bool AdcCommand(void)
|
|||||||
}
|
}
|
||||||
ResponseAppend_P(PSTR("]}"));
|
ResponseAppend_P(PSTR("]}"));
|
||||||
}
|
}
|
||||||
else if (CMND_ADCPARAM == command_code) {
|
|
||||||
|
void CmndAdcParam(void)
|
||||||
|
{
|
||||||
if (XdrvMailbox.data_len) {
|
if (XdrvMailbox.data_len) {
|
||||||
if ((ADC0_TEMP == XdrvMailbox.payload) || (ADC0_LIGHT == XdrvMailbox.payload)) {
|
if ((ADC0_TEMP == XdrvMailbox.payload) || (ADC0_LIGHT == XdrvMailbox.payload)) {
|
||||||
// if ((XdrvMailbox.payload == my_adc0) && ((ADC0_TEMP == my_adc0) || (ADC0_LIGHT == my_adc0))) {
|
// if ((XdrvMailbox.payload == my_adc0) && ((ADC0_TEMP == my_adc0) || (ADC0_LIGHT == my_adc0))) {
|
||||||
@ -247,10 +247,6 @@ bool AdcCommand(void)
|
|||||||
Response_P(PSTR("{\"" D_CMND_ADCPARAM "\":[%d,%d,%d,%s]}"),
|
Response_P(PSTR("{\"" D_CMND_ADCPARAM "\":[%d,%d,%d,%s]}"),
|
||||||
Settings.adc_param_type, Settings.adc_param1, Settings.adc_param2, param3);
|
Settings.adc_param_type, Settings.adc_param1, Settings.adc_param2, param3);
|
||||||
}
|
}
|
||||||
else serviced = false; // Unknown command
|
|
||||||
|
|
||||||
return serviced;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Interface
|
* Interface
|
||||||
@ -262,7 +258,7 @@ bool Xsns02(uint8_t function)
|
|||||||
|
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case FUNC_COMMAND:
|
case FUNC_COMMAND:
|
||||||
result = AdcCommand();
|
result = DecodeCommand(kAdcCommands, AdcCommand);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ((ADC0_INPUT == my_adc0) || (ADC0_TEMP == my_adc0) || (ADC0_LIGHT == my_adc0)) {
|
if ((ADC0_INPUT == my_adc0) || (ADC0_TEMP == my_adc0) || (ADC0_LIGHT == my_adc0)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user