// fill global RAM buffer with current state of system void scene_write_buf(void) { u8* dst = (u8*)(sceneData->pickle); u32 bytes = 0; u8* newDst = NULL; ///// print parmameters // u32 i; print_dbg("\r\n writing scene data... "); /* for(i=0; i<net->numParams; i++) { print_dbg("\r\n param "); print_dbg_ulong(i); print_dbg(" : "); print_dbg(net->params[i].desc.label); print_dbg(" ; val "); print_dbg_hex((u32)net->params[i].data.value.asInt); } */ // pickle network newDst = net_pickle(dst); bytes += (newDst - dst); print_dbg("\r\n bytes written: 0x"); print_dbg_hex(bytes); dst = newDst; // pickle presets newDst = presets_pickle(dst); bytes += (newDst - dst); print_dbg("\r\n bytes written: 0x"); print_dbg_hex(bytes); dst = newDst; /* if((u32)dst > ((u32)(sceneData->pickle) + SCENE_PICKLE_SIZE)) { */ /* print_dbg(" !!!!!!!! error: serialized scene data is exceeded allocated bounds !!!!! "); */ /* } */ if(bytes > SCENE_PICKLE_SIZE) { print_dbg(" !!!!!!!! error: serialized scene data is exceeded allocated bounds !!!!! "); } }
// fill global RAM buffer with current state of system void scene_write_buf(void) { u8* dst = (u8*)(sceneData->pickle); char test[SCENE_NAME_LEN] = " "; u32 bytes = 0; u8* newDst = NULL; int i; ///// print paramameters // u32 i; print_dbg("\r\n writing scene data... "); /* for(i=0; i<net->numParams; i++) { print_dbg("\r\n param "); print_dbg_ulong(i); print_dbg(" : "); print_dbg(net->params[i].desc.label); print_dbg(" ; val "); print_dbg_hex((u32)net->params[i].data.value.asInt); } */ // write name for(i=0; i<SCENE_NAME_LEN; i++) { *dst = sceneData->desc.sceneName[i]; dst++; bytes++; } // write bees version *dst = sceneData->desc.beesVersion.min; dst++; bytes++; *dst = sceneData->desc.beesVersion.maj; dst++; bytes++; dst = pickle_16(sceneData->desc.beesVersion.rev, dst); bytes += 2; print_dbg("\r\n scene_write buf; module name: "); print_dbg(sceneData->desc.moduleName); // write module name for(i=0; i<MODULE_NAME_LEN; i++) { *dst = (sceneData->desc.moduleName)[i]; dst++; bytes++; } //// TEST for(i=0; i<MODULE_NAME_LEN; i++) { test[i] = *(dst - MODULE_NAME_LEN + i); } print_dbg("; test buffer after write: "); print_dbg(test); //// // write module version *dst = sceneData->desc.moduleVersion.min; dst++; *dst = sceneData->desc.moduleVersion.maj; dst++; dst = pickle_16(sceneData->desc.moduleVersion.rev, dst); bytes += 4; // pickle network newDst = net_pickle(dst); bytes += (newDst - dst); print_dbg("\r\n pickled network, bytes written: 0x"); print_dbg_hex(bytes); dst = newDst; // pickle presets newDst = presets_pickle(dst); bytes += (newDst - dst); print_dbg("\r\n pickled presets, bytes written: 0x"); print_dbg_hex(bytes); dst = newDst; #if RELEASEBUILD==1 #else if(bytes > SCENE_PICKLE_SIZE - 0x800) { print_dbg(" !!!!!!!! warning: serialized scene data approaching allocated bounds !!!!! "); } if(bytes > SCENE_PICKLE_SIZE) { print_dbg(" !!!!!!!! error: serialized scene data exceeded allocated bounds !!!!! "); } #endif }