Skip to content

Commit

Permalink
Merge pull request #485 from ZuluSCSI/main
Browse files Browse the repository at this point in the history
pull main in to dev branch
  • Loading branch information
aperezbios authored Dec 13, 2024
2 parents 86bc8a5 + 0771c8f commit 2b014cf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
11 changes: 6 additions & 5 deletions lib/ZuluSCSI_platform_RP2MCU/ZuluSCSI_platform_msc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,21 @@
#error "CFG_TUD_MSC_EP_BUFSIZE is too small! It needs to be at least 512 (SD_SECTOR_SIZE)"
#endif

#define DIGITAL_PIN_CYW43_OFFSET 64

// external global SD variable
extern SdFs SD;
static bool unitReady = false;

/* return true if USB presence detected / eligble to enter CR mode */
bool platform_sense_msc() {

#ifdef ZULUSCSI_PICO_2
if (!gpio_get(GPIO_USB_POWER))
return false;
#elif defined(ZULUSCSI_PICO)
#if defined(ZULUSCSI_PICO) || defined(ZULUSCSI_PICO_2)
// check if we're USB powered, if not, exit immediately
// pin on the wireless module, see https://github.com/earlephilhower/arduino-pico/discussions/835
if (rp2040.isPicoW() && !digitalRead(34))
// Update: from the above discussion the offset 32 has been changed to 64 to access CYW43 GPIO pins
// since the addition of the RP2350 chips, now stored in the DIGITAL_PIN_CYW43_OFFSET define
if (rp2040.isPicoW() && !digitalRead(DIGITAL_PIN_CYW43_OFFSET + 2))
return false;

if (!rp2040.isPicoW() && !digitalRead(24))
Expand Down
15 changes: 8 additions & 7 deletions lib/ZuluSCSI_platform_RP2MCU/ZuluSCSI_platform_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,14 @@ int platform_network_init(char *mac)
if (mac == NULL || (mac[0] == 0 && mac[1] == 0 && mac[2] == 0 && mac[3] == 0 && mac[4] == 0 && mac[5] == 0))
{
mac = (char *)&set_mac;
char octal_strings[8][4] = {0};
memcpy(mac, defaultMAC, sizeof(set_mac));

// retain Dayna vendor but use a device id specific to this board
pico_get_unique_board_id(&board_id);
if (g_log_debug)
logmsg("Unique board id: ", board_id.id[0], " ", board_id.id[1], " ", board_id.id[2], " ", board_id.id[3], " ",
board_id.id[4], " ", board_id.id[5], " ", board_id.id[6], " ", board_id.id[7]);

dbgmsg("Unique board id: ", board_id.id[0], " ", board_id.id[1], " ", board_id.id[2], " ", board_id.id[3], " ",
board_id.id[4], " ", board_id.id[5], " ", board_id.id[6], " ", board_id.id[7]);

if (board_id.id[3] != 0 && board_id.id[4] != 0 && board_id.id[5] != 0)
{
Expand All @@ -102,11 +103,11 @@ int platform_network_init(char *mac)
cyw43_arch_enable_sta_mode();

cyw43_wifi_get_mac(&cyw43_state, CYW43_ITF_STA, read_mac);
logmsg("Wi-Fi MAC: ", read_mac[0],":",read_mac[1], ":", read_mac[2], ":", read_mac[3], ":", read_mac[4], ":", read_mac[5]);
char mac_hex_string[4*6] = {0};
sprintf(mac_hex_string, "%02X:%02X:%02X:%02X:%02X:%02X", read_mac[0], read_mac[1], read_mac[2], read_mac[3], read_mac[4], read_mac[5]);
logmsg("Wi-Fi MAC: ", mac_hex_string);
if (memcmp(mac, read_mac, sizeof(read_mac)) != 0)
logmsg("WARNING: Wi-Fi MAC is not what was requested (",
(uint8_t)mac[0], ":", (uint8_t)mac[1], ":", (uint8_t)mac[2], ":", (uint8_t)mac[3], ":", (uint8_t)mac[4], ":", (uint8_t)mac[5],
"), is libpico not compiled with CYW43_USE_OTP_MAC=0?");
logmsg("WARNING: Wi-Fi MAC is not what was requested (", mac_hex_string,"), is libpico not compiled with CYW43_USE_OTP_MAC=0?");

network_in_use = true;

Expand Down
4 changes: 2 additions & 2 deletions src/ZuluSCSI_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include <ZuluSCSI_platform_config.h>

// Use variables for version number
#define FW_VER_NUM "24.12.09"
#define FW_VER_SUFFIX "dev"
#define FW_VER_NUM "24.12.12"
#define FW_VER_SUFFIX "release"

#define DEF_STRINGFY(DEF) STRINGFY(DEF)
#define STRINGFY(STR) #STR
Expand Down

0 comments on commit 2b014cf

Please sign in to comment.