diff --git a/97_compile4plus.sh b/97_compile4plus.sh new file mode 100755 index 0000000..737a6bb --- /dev/null +++ b/97_compile4plus.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# arduino-cli compile -help +arduino-cli compile -b esp32:esp32:m5stack_stickc_plus -v -e FactoryTest + diff --git a/98_write4plus.sh b/98_write4plus.sh new file mode 100755 index 0000000..0b73d1f --- /dev/null +++ b/98_write4plus.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +source ./lib.sh + +# Get esptool command +BUILD_TOOL=$(lib_get_esptool_command) +# BUILD_TOOLの文字列の長さが20以上の場合は、終了する +if [ ${#BUILD_TOOL} -ge 20 ]; then + echo $BUILD_TOOL + echo "===" + echo "Please execute the script again." + echo "(上記のメッセージを確認したあと) もう一度実行してください。" + echo "===" + exit 1 +fi + +# Find port - Cross-platform detection +PORT=$(lib_detect_esptool_port) + +# Check if PORT is set, otherwise prompt user +if [ -z "$PORT" ]; then + lib_no_esp_device_message_and_exit +fi + +echo "Using port: $PORT" + +# Define the paths to the firmware files +BUILD_PATH="FactoryTest/build/esp32.esp32.m5stack_stickc_plus" +BOOTLOADER_PATH="$BUILD_PATH/FactoryTest.ino.bootloader.bin" +PARTITIONS_PATH="$BUILD_PATH/FactoryTest.ino.partitions.bin" +FIRMWARE_PATH="$BUILD_PATH/FactoryTest.ino.bin" + +# Check if all required files exist +if [ ! -f "$BOOTLOADER_PATH" ]; then + echo "Bootloader file not found at $BOOTLOADER_PATH" + exit 1 +fi +if [ ! -f "$PARTITIONS_PATH" ]; then + echo "Partitions file not found at $PARTITIONS_PATH" + exit 1 +fi +if [ ! -f "$FIRMWARE_PATH" ]; then + echo "Firmware file not found at $FIRMWARE_PATH" + exit 1 +fi + +echo "Flashing complete FactoryTest firmware..." +echo "Bootloader: $BOOTLOADER_PATH" +echo "Partitions: $PARTITIONS_PATH" +echo "Main firmware: $FIRMWARE_PATH" + +# Upload the complete firmware using esptool.py +$BUILD_TOOL --chip esp32 --port "$PORT" --baud 115200 write-flash -z \ + 0x1000 "$BOOTLOADER_PATH" \ + 0x8000 "$PARTITIONS_PATH" \ + 0x10000 "$FIRMWARE_PATH" + +echo "Flashing completed." + +# Open serial monitor +read -p "シリアルモニタを開きますか?(y/n): " yn +if [ $yn = "y" ]; then + echo "終了するときはCtrl+Cを押してください。" + arduino-cli monitor -p "$PORT" --config 115200 +fi + diff --git a/FactoryTest/FactoryTest.ino b/FactoryTest/FactoryTest.ino index 9cdfd26..6e4bebe 100644 --- a/FactoryTest/FactoryTest.ino +++ b/FactoryTest/FactoryTest.ino @@ -1078,12 +1078,12 @@ Disbuff.setTextColor(TFT_WHITE); } -void onESPNOWSent(const wifi_tx_info_t *mac_addr, esp_now_send_status_t status) +void onESPNOWSent(const uint8_t *mac_addr, esp_now_send_status_t status) { char macStr[18]; snprintf(macStr, sizeof(macStr), "%02X:%02X:%02X:%02X:%02X:%02X", - mac_addr->src_addr[0], mac_addr->src_addr[1], mac_addr->src_addr[2], - mac_addr->src_addr[3], mac_addr->src_addr[4], mac_addr->src_addr[5]); + mac_addr[0], mac_addr[1], mac_addr[2], + mac_addr[3], mac_addr[4], mac_addr[5]); // Serial.print("Last Packet Sent to: "); // Serial.println(macStr); // Serial.print("Last Packet Send Status: ");