Skip to content

Commit

Permalink
Merge branch 'master' into ch341
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-bennett authored Dec 10, 2024
2 parents 4ecb37d + 438f627 commit 970eb0b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bin/config.d/OpenWRT_One_mikroBUS_sx1262.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Lora:
Module: sx1262
IRQ: 10
Busy: 12
Reset: 2
# Reset: 2
spidev: spidev2.0
DIO2_AS_RF_SWITCH: true
DIO3_TCXO_VOLTAGE: true
5 changes: 4 additions & 1 deletion src/detect/ScanI2CTwoWire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,14 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)

case CGRADSENS_ADDR:
// Register 0x00 of the RadSens sensor contains is product identifier 0x7D
// Undocumented, but some devices return a product identifier of 0x7A
registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x00), 1);
if (registerValue == 0x7D) {
if (registerValue == 0x7D || registerValue == 0x7A) {
type = CGRADSENS;
logFoundDevice("ClimateGuard RadSens", (uint8_t)addr.address);
break;
} else {
LOG_DEBUG("Unexpected Device ID for RadSense: addr=0x%x id=0x%x", CGRADSENS_ADDR, registerValue);
}
break;

Expand Down
8 changes: 3 additions & 5 deletions src/platform/portduino/PortduinoGlue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ void getMacAddr(uint8_t *dmac)
if (optionMac != nullptr && strlen(optionMac) > 0) {
if (strlen(optionMac) >= 12) {
MAC_from_string(optionMac, dmac);
std::cout << optionMac << std::endl;
} else {
uint32_t hwId = sscanf(optionMac, "%u", &hwId);
dmac[0] = 0x80;
Expand All @@ -98,7 +97,6 @@ void getMacAddr(uint8_t *dmac)
}
} else if (settingsStrings[mac_address].length() > 11) {
MAC_from_string(settingsStrings[mac_address], dmac);
std::cout << settingsStrings[mac_address] << std::endl;
exit;
} else {

Expand Down Expand Up @@ -203,14 +201,14 @@ void portduinoSetup()
}
}

uint8_t dmac[6];
uint8_t dmac[6] = {0};
getMacAddr(dmac);
if (dmac[0] == 0 && dmac[1] == 0 && dmac[2] == 0 && dmac[3] == 0 && dmac[4] == 0 && dmac[5] == 0) {
std::cout << "*** Blank MAC Address not allowed!" << std::endl;
std::cout << "Please set a MAC Address in config.yaml using either MACAddress or MACAddressSource." << std::endl;
exit(EXIT_FAILURE);
}
printBytes("MAC Address: ", dmac, 6);
std::cout << "MAC Address: " << std::hex << +dmac[0] << +dmac[1] << +dmac[2] << +dmac[3] << +dmac[4] << +dmac[5] << std::endl;
// Rather important to set this, if not running simulated.
randomSeed(time(NULL));

Expand Down Expand Up @@ -535,4 +533,4 @@ bool MAC_from_string(std::string mac_str, uint8_t *dmac)
} else {
return false;
}
}
}

0 comments on commit 970eb0b

Please sign in to comment.