mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 20:56:35 +00:00
Add command `Sensor80 1 <0..7>
`
Add command ``Sensor80 1 <0..7>`` to control MFRC522 RFID antenna gain from 18dB (0) to 48dB (7) (#11073)
This commit is contained in:
parent
35427d9b36
commit
c3c0a06961
@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
### Added
|
### Added
|
||||||
- Allow MCP230xx pinmode from output to input (#11104)
|
- Allow MCP230xx pinmode from output to input (#11104)
|
||||||
- SML VBUS support (#11125)
|
- SML VBUS support (#11125)
|
||||||
|
- Command ``Sensor80 1 <0..7>`` to control MFRC522 RFID antenna gain from 18dB (0) to 48dB (7) (#11073)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- TuyaMcu dimmer timeout (#11121)
|
- TuyaMcu dimmer timeout (#11121)
|
||||||
|
@ -82,6 +82,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
|
|||||||
### Added
|
### Added
|
||||||
- Allow MCP230xx pinmode from output to input [#11104](https://github.com/arendst/Tasmota/issues/11104)
|
- Allow MCP230xx pinmode from output to input [#11104](https://github.com/arendst/Tasmota/issues/11104)
|
||||||
- SML VBUS support [#11125](https://github.com/arendst/Tasmota/issues/11125)
|
- SML VBUS support [#11125](https://github.com/arendst/Tasmota/issues/11125)
|
||||||
|
- Command ``Sensor80 1 <0..7>`` to control MFRC522 RFID antenna gain from 18dB (0) to 48dB (7) [#11073](https://github.com/arendst/Tasmota/issues/11073)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- TuyaMcu dimmer timeout [#11121](https://github.com/arendst/Tasmota/issues/11121)
|
- TuyaMcu dimmer timeout [#11121](https://github.com/arendst/Tasmota/issues/11121)
|
||||||
|
@ -126,6 +126,36 @@ void RC522Show(void) {
|
|||||||
}
|
}
|
||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
|
|
||||||
|
/*********************************************************************************************\
|
||||||
|
* Supported commands for Sensor80:
|
||||||
|
*
|
||||||
|
* Sensor80 1 - Show antenna gain
|
||||||
|
* Sensor80 1 <gain> - Set antenna gain 0..7 (default 4)
|
||||||
|
\*********************************************************************************************/
|
||||||
|
|
||||||
|
bool RC522Command(void) {
|
||||||
|
bool serviced = true;
|
||||||
|
char argument[XdrvMailbox.data_len];
|
||||||
|
|
||||||
|
for (uint32_t ca = 0; ca < XdrvMailbox.data_len; ca++) {
|
||||||
|
if ((' ' == XdrvMailbox.data[ca]) || ('=' == XdrvMailbox.data[ca])) { XdrvMailbox.data[ca] = ','; }
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (XdrvMailbox.payload) {
|
||||||
|
case 1: // Antenna gain
|
||||||
|
uint8_t gain;
|
||||||
|
if (strchr(XdrvMailbox.data, ',') != nullptr) {
|
||||||
|
gain = strtol(ArgV(argument, 2), nullptr, 10) & 0x7;
|
||||||
|
Mfrc522->PCD_SetAntennaGain(gain << 4);
|
||||||
|
}
|
||||||
|
gain = Mfrc522->PCD_GetAntennaGain() >> 4; // 0..7
|
||||||
|
Response_P(PSTR("{\"Sensor80\":{\"Gain\":%d}}"), gain);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return serviced;
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Interface
|
* Interface
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
@ -145,6 +175,11 @@ bool Xsns80(uint8_t function) {
|
|||||||
RC522ScanForTag();
|
RC522ScanForTag();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case FUNC_COMMAND_SENSOR:
|
||||||
|
if (XSNS_80 == XdrvMailbox.index) {
|
||||||
|
result = RC522Command();
|
||||||
|
}
|
||||||
|
break;
|
||||||
#ifdef USE_WEBSERVER
|
#ifdef USE_WEBSERVER
|
||||||
case FUNC_WEB_SENSOR:
|
case FUNC_WEB_SENSOR:
|
||||||
RC522Show();
|
RC522Show();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user