From 696b676760332e671bcf68601c6c6aeb5ac99a61 Mon Sep 17 00:00:00 2001 From: masatake aoki Date: Wed, 21 May 2025 18:51:15 +0900 Subject: [PATCH] map write/read bug fix --- pico_classic_v4_STEP8_micromouse/Flash.ino | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pico_classic_v4_STEP8_micromouse/Flash.ino b/pico_classic_v4_STEP8_micromouse/Flash.ino index 8bd0edd..655a575 100644 --- a/pico_classic_v4_STEP8_micromouse/Flash.ino +++ b/pico_classic_v4_STEP8_micromouse/Flash.ino @@ -100,8 +100,8 @@ void mapWrite(void) Serial.println("- failed to open file for writing"); return; } - for (int i = 0; i < 16; i++) { - for (int j = 0; j < 16; j++) { + for (int i = 0; i < MAZESIZE_X; i++) { + for (int j = 0; j < MAZESIZE_Y; j++) { data_temp = g_map.wallDataGet(i, j, north) + (g_map.wallDataGet(i, j, east) << 2) + (g_map.wallDataGet(i, j, south) << 4) + (g_map.wallDataGet(i, j, west) << 6); if (file.write(data_temp)) { //バイナリ書き込み @@ -129,8 +129,8 @@ void mapCopy(void) Serial.println("- failed to open file for reading"); return; } - for (int i = 0; i < 16; i++) { - for (int j = 0; j < 16; j++) { + for (int i = 0; i < MAZESIZE_X; i++) { + for (int j = 0; j < MAZESIZE_Y; j++) { if (file.available()) { read_data = file.read(); g_map.wallDataSet(i, j, north, read_data & 0x03);