- fixed a bug and renamed generic iteration counter i as tileNum

This commit is contained in:
Luciano Martin
2017-12-11 13:50:41 +00:00
parent 5edf026716
commit 22bcce2e2f

View File

@@ -60,9 +60,9 @@ void device_reboot_aux(void)
#ifdef __XS2A__ #ifdef __XS2A__
/* Find tile number of the local tile ID*/ /* Find tile number of the local tile ID*/
for(int i = 0; i<tileArrayLength; i++) { for(int tileNum = 0; tileNum<tileArrayLength; tileNum++) {
if (get_tile_id(tile[i]) == localTileId) { if (get_tile_id(tile[tileNum]) == localTileId) {
localTileNum = i; localTileNum = tileNum;
break; break;
} }
} }
@@ -70,22 +70,22 @@ void device_reboot_aux(void)
#ifndef __XS2A__ #ifndef __XS2A__
/* Reset all tiles, starting from the remote ones */ /* Reset all tiles, starting from the remote ones */
for(int i = tileArrayLength-1; i>=0; i--) for(int tileNum = tileArrayLength-1; tileNum>=0; tileNum--)
#else #else
/* Reset all even tiles, starting from the remote ones */ /* Reset all even tiles, starting from the remote ones */
for(int i = tileArrayLength-2; i>=0; i=i-2) for(int tileNum = tileArrayLength-2; tileNum>=0; tileNum=tileNum-2)
#endif #endif
{ {
/* Cannot cast tileref to unsigned! */ /* Cannot cast tileref to unsigned! */
tileId = get_tile_id(tile[i]); tileId = get_tile_id(tile[tileNum]);
/* Do not reboot local tile yet! */ /* Do not reboot local tile yet! */
#ifndef __XS2A__ #ifndef __XS2A__
if(localTileId != tileId) if(localTileId != tileId)
#else #else
/* In XS2A the tile paired up with the local tile can't be rebooted either */ /* In XS2A the tile paired up with the local tile can't be rebooted either */
if((localTileNum&0xFFFE) != (tileId&0xFFFE)) if((localTileNum|0x01) != (tileNum|0x01))
#endif #endif
{ {
reset_tile(tileId); reset_tile(tileId);