From 5390f7613135f9c5795c1ae5a838751816d32eaf Mon Sep 17 00:00:00 2001 From: ABelliqueux Date: Sun, 2 May 2021 12:52:09 +0200 Subject: [PATCH] switch to new cmd scheme --- levels/level0.c | 1 - levels/level0.h | 1 - levels/level1.c | 1 - levels/level1.h | 1 - loadlvl.py | 18 +++++++++++++++--- main.c | 21 ++++++++++++++------- 6 files changed, 29 insertions(+), 14 deletions(-) diff --git a/levels/level0.c b/levels/level0.c index afb2627..acc8136 100644 --- a/levels/level0.c +++ b/levels/level0.c @@ -5377,4 +5377,3 @@ LEVEL level0 = { &level0_nodegnd, &level0_meshPlan }; - diff --git a/levels/level0.h b/levels/level0.h index 382f784..b60219b 100644 --- a/levels/level0.h +++ b/levels/level0.h @@ -321,4 +321,3 @@ extern NODE level0_nodegnd_001; extern NODE level0_nodegnd_002; extern NODE level0_nodegnd_003; - diff --git a/levels/level1.c b/levels/level1.c index 00e33c2..6108cbb 100644 --- a/levels/level1.c +++ b/levels/level1.c @@ -10989,4 +10989,3 @@ LEVEL level1 = { &level1_nodegnd_002, &level1_meshPlan }; - diff --git a/levels/level1.h b/levels/level1.h index 31df560..fc12c96 100644 --- a/levels/level1.h +++ b/levels/level1.h @@ -345,4 +345,3 @@ extern NODE level1_nodegnd_001; extern NODE level1_nodegnd_002; extern NODE level1_nodegnd_003; - diff --git a/loadlvl.py b/loadlvl.py index 996d6a2..29585d5 100755 --- a/loadlvl.py +++ b/loadlvl.py @@ -237,7 +237,7 @@ def WriteBytes( inData ): if DEBUG: - print( str ( numChunk + 1 - currentChunk ) + " chunks of " + str ( chunkSize) + "bytes to send " ) + print( str ( numChunk + 1 - currentChunk ) + " chunks of " + str ( chunkSize) + " bytes to send " ) # Avoid going out of range @@ -257,6 +257,10 @@ def WriteBytes( inData ): # Send byte + if DEBUG > 1: + + print("Writing " + str( inData[ i + byte ].to_bytes(1, byteorder='little', signed=False) ) + " to serial..." ) + ser.write( inData[ i + byte ].to_bytes(1, byteorder='little', signed=False) ) # Calculate chunk checksum @@ -419,7 +423,7 @@ def SendBin( inData, memAddr ): def resetListener(): - global checkSum, data, Listen, Transfer, dataSize, memAddr, loadFile, flagAddr + global checkSum, data, Listen, Transfer, dataSize, memAddr, loadFile, flagAddr, levelId memAddr = "" @@ -435,6 +439,8 @@ def resetListener(): Transfer = 0 + levelId = 0 + Listen = 1 ser.reset_input_buffer() @@ -559,7 +565,7 @@ def main(args): "File : " + loadFile + "\n" + - "Bin : " + binFileName + "ID : " + str(levelId) + "Bin : " + binFileName + " - ID : " + str(levelId) ) @@ -597,6 +603,12 @@ def main(args): # Set level changed flag + if DEBUG: + + print("Sending value " + str( levelId.to_bytes(1, byteorder='little', signed=False) ) + " to " + flagAddr ) + + time.sleep( sleepTime ) + SendBin( levelId.to_bytes(1, byteorder='little', signed=False) , flagAddr) # Reset everything diff --git a/main.c b/main.c index cddaaa6..19ea912 100644 --- a/main.c +++ b/main.c @@ -29,9 +29,9 @@ #include "physics.h" #include "graphics.h" #include "space.h" -#include "pcdrv.h" +//~ #include "pcdrv.h" -//~ #define USECD +#define USECD // START OVERLAY @@ -77,8 +77,12 @@ u_long overlaySize = 0; // Level -u_short level = 1; +volatile u_char level = 1; +// level 1 : 8003F05C -2147225508 +// level 0 : 800AF744 -2146764988 +// 80010000 -2147418112 -> -2147483648 +// ovl : 800b80d4 -2146729772 u_short levelWas = 0; u_short levelHasChanged = 0; @@ -124,7 +128,9 @@ CAMERA camera = {0}; // physics -long time = 0; +u_long time = 0; + +u_long timeS = 0; //Pad @@ -357,6 +363,8 @@ int main() { while ( VSync(1) ) { + timeS = VSync(-1) / 60; + if ( levelWas != level ){ switch ( level ){ @@ -1084,7 +1092,7 @@ int main() { //~ FntPrint("curLvl.curNode : %x\nIndex: %d", curLvl.curNode, curLvl.curNode->siblings->index); - FntPrint("Time : %d dt :%d\n", VSync(-1) / 60, dt); + FntPrint("Time : %d dt :%d", timeS, dt); //~ FntPrint("%d\n", curCamAngle ); //~ FntPrint("%x\n", primbuff[db]); @@ -1411,8 +1419,7 @@ void callback() { timer = 30; lastPad = PADL; - - + } if( theControllers[0].type == 0x73 && camMode == 0){