chore: `byte to uint8_t`

This commit is contained in:
Yurii
2025-09-23 04:03:36 +03:00
parent 28a5218b7c
commit 14826c10cd
6 changed files with 31 additions and 32 deletions

View File

@@ -4,8 +4,8 @@
class CustomOpenTherm : public OpenTherm {
public:
typedef std::function<void(unsigned int)> DelayCallback;
typedef std::function<void(unsigned long, byte)> BeforeSendRequestCallback;
typedef std::function<void(unsigned long, unsigned long, OpenThermResponseStatus, byte)> AfterSendRequestCallback;
typedef std::function<void(unsigned long, uint8_t)> BeforeSendRequestCallback;
typedef std::function<void(unsigned long, unsigned long, OpenThermResponseStatus, uint8_t)> AfterSendRequestCallback;
CustomOpenTherm(int inPin = 4, int outPin = 5, bool isSlave = false, bool alwaysReceive = false) : OpenTherm(inPin, outPin, isSlave, alwaysReceive) {}
~CustomOpenTherm() {}
@@ -106,15 +106,14 @@ public:
return isValidResponse(response) && isValidResponseId(response, OpenThermMessageID::RemoteRequest);
}
static bool isCh2Active(unsigned long response)
{
static bool isCh2Active(unsigned long response) {
return response & 0x20;
}
static bool isValidResponseId(unsigned long response, OpenThermMessageID id) {
byte responseId = (response >> 16) & 0xFF;
uint8_t responseId = (response >> 16) & 0xFF;
return (byte)id == responseId;
return (uint8_t)id == responseId;
}
static uint8_t getResponseMessageTypeId(unsigned long response) {

View File

@@ -35,7 +35,7 @@ namespace NetworkUtils {
return this;
}
NetworkMgr* setApCredentials(const char* ssid, const char* password = nullptr, byte channel = 0) {
NetworkMgr* setApCredentials(const char* ssid, const char* password = nullptr, uint8_t channel = 0) {
this->apName = ssid;
this->apPassword = password;
this->apChannel = channel;
@@ -43,7 +43,7 @@ namespace NetworkUtils {
return this;
}
NetworkMgr* setStaCredentials(const char* ssid = nullptr, const char* password = nullptr, byte channel = 0) {
NetworkMgr* setStaCredentials(const char* ssid = nullptr, const char* password = nullptr, uint8_t channel = 0) {
this->staSsid = ssid;
this->staPassword = password;
this->staChannel = channel;
@@ -140,7 +140,7 @@ namespace NetworkUtils {
return this->staPassword;
}
byte getStaChannel() {
uint8_t getStaChannel() {
return this->staChannel;
}
@@ -377,7 +377,7 @@ namespace NetworkUtils {
}
}
static byte rssiToSignalQuality(short int rssi) {
static uint8_t rssiToSignalQuality(short int rssi) {
return constrain(map(rssi, -100, -50, 0, 100), 0, 100);
}
@@ -397,11 +397,11 @@ namespace NetworkUtils {
const char* hostname = "esp";
const char* apName = "ESP";
const char* apPassword = nullptr;
byte apChannel = 1;
uint8_t apChannel = 1;
const char* staSsid = nullptr;
const char* staPassword = nullptr;
byte staChannel = 0;
uint8_t staChannel = 0;
bool useDhcp = true;
IPAddress staticIp;