diff --git a/firmware/v5-common.ld b/firmware/v5-common.ld index e3ea12e1d..762a90551 100644 --- a/firmware/v5-common.ld +++ b/firmware/v5-common.ld @@ -27,15 +27,15 @@ SECTIONS *(.vfp11_veneer) *(.ARM.extab) *(.gnu.linkonce.armextab.*) -} > MEMORY +} > RAM .init : { KEEP (*(.init)) -} > MEMORY +} > RAM .fini : { KEEP (*(.fini)) -} > MEMORY +} > RAM .rodata : { __rodata_start = .; @@ -43,14 +43,14 @@ SECTIONS *(.rodata.*) *(.gnu.linkonce.r.*) __rodata_end = .; -} > MEMORY +} > RAM .rodata1 : { __rodata1_start = .; *(.rodata1) *(.rodata1.*) __rodata1_end = .; -} > MEMORY +} > RAM .sdata2 : { __sdata2_start = .; @@ -58,7 +58,7 @@ SECTIONS *(.sdata2.*) *(.gnu.linkonce.s2.*) __sdata2_end = .; -} > MEMORY +} > RAM .sbss2 : { __sbss2_start = .; @@ -66,7 +66,7 @@ SECTIONS *(.sbss2.*) *(.gnu.linkonce.sb2.*) __sbss2_end = .; -} > MEMORY +} > RAM .data : { __data_start = .; @@ -77,18 +77,18 @@ SECTIONS *(.got) *(.got.plt) __data_end = .; -} > MEMORY +} > RAM .data1 : { __data1_start = .; *(.data1) *(.data1.*) __data1_end = .; -} > MEMORY +} > RAM .got : { *(.got) -} > MEMORY +} > RAM .ctors : { __CTOR_LIST__ = .; @@ -99,7 +99,7 @@ SECTIONS KEEP (*(.ctors)) __CTOR_END__ = .; ___CTORS_END___ = .; -} > MEMORY +} > RAM .dtors : { __DTOR_LIST__ = .; @@ -110,67 +110,67 @@ SECTIONS KEEP (*(.dtors)) __DTOR_END__ = .; ___DTORS_END___ = .; -} > MEMORY +} > RAM .fixup : { __fixup_start = .; *(.fixup) __fixup_end = .; -} > MEMORY +} > RAM .eh_frame : { *(.eh_frame) -} > MEMORY +} > RAM .eh_framehdr : { __eh_framehdr_start = .; *(.eh_framehdr) __eh_framehdr_end = .; -} > MEMORY +} > RAM .gcc_except_table : { *(.gcc_except_table) -} > MEMORY +} > RAM .mmu_tbl (ALIGN(16384)) : { __mmu_tbl_start = .; *(.mmu_tbl) __mmu_tbl_end = .; -} > MEMORY +} > RAM .ARM.exidx : { __exidx_start = .; *(.ARM.exidx*) *(.gnu.linkonce.armexidix.*.*) __exidx_end = .; -} > MEMORY +} > RAM .preinit_array : { __preinit_array_start = .; KEEP (*(SORT(.preinit_array.*))) KEEP (*(.preinit_array)) __preinit_array_end = .; -} > MEMORY +} > RAM .init_array : { __init_array_start = .; KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array)) __init_array_end = .; -} > MEMORY +} > RAM .fini_array : { __fini_array_start = .; KEEP (*(SORT(.fini_array.*))) KEEP (*(.fini_array)) __fini_array_end = .; -} > MEMORY +} > RAM .ARM.attributes : { __ARM.attributes_start = .; *(.ARM.attributes) __ARM.attributes_end = .; -} > MEMORY +} > RAM .sdata : { __sdata_start = .; @@ -178,7 +178,7 @@ SECTIONS *(.sdata.*) *(.gnu.linkonce.s.*) __sdata_end = .; -} > MEMORY +} > RAM .sbss (NOLOAD) : { __sbss_start = .; @@ -186,7 +186,7 @@ SECTIONS *(.sbss.*) *(.gnu.linkonce.sb.*) __sbss_end = .; -} > MEMORY +} > RAM .tdata : { __tdata_start = .; @@ -194,7 +194,7 @@ SECTIONS *(.tdata.*) *(.gnu.linkonce.td.*) __tdata_end = .; -} > MEMORY +} > RAM .tbss : { __tbss_start = .; @@ -202,7 +202,7 @@ SECTIONS *(.tbss.*) *(.gnu.linkonce.tb.*) __tbss_end = .; -} > MEMORY +} > RAM .bss (NOLOAD) : { __bss_start = .; @@ -211,7 +211,7 @@ SECTIONS *(.gnu.linkonce.b.*) *(COMMON) __bss_end = .; -} > MEMORY +} > RAM _SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 ); diff --git a/firmware/v5-hot.ld b/firmware/v5-hot.ld index 259bab9ba..017cb3564 100644 --- a/firmware/v5-hot.ld +++ b/firmware/v5-hot.ld @@ -28,6 +28,6 @@ MEMORY HOT_MEMORY : ORIGIN = start_of_hot_mem, LENGTH = _HOT_MEM_SIZE /* Just over 8 MB */ } -REGION_ALIAS("MEMORY", HOT_MEMORY); +REGION_ALIAS("RAM", HOT_MEMORY); ENTRY(install_hot_table) diff --git a/firmware/v5.ld b/firmware/v5.ld index d6933d9d2..7cbd06f3b 100644 --- a/firmware/v5.ld +++ b/firmware/v5.ld @@ -28,6 +28,6 @@ MEMORY HOT_MEMORY : ORIGIN = start_of_hot_mem, LENGTH = _HOT_MEM_SIZE /* Just over 8 MB */ } -REGION_ALIAS("MEMORY", COLD_MEMORY); +REGION_ALIAS("RAM", COLD_MEMORY); ENTRY(vexStartup) diff --git a/include/api.h b/include/api.h index e3fb1ab2d..27a7b643f 100644 --- a/include/api.h +++ b/include/api.h @@ -41,8 +41,8 @@ #define PROS_VERSION_MAJOR 3 #define PROS_VERSION_MINOR 6 -#define PROS_VERSION_PATCH 1 -#define PROS_VERSION_STRING "3.6.1" +#define PROS_VERSION_PATCH 2 +#define PROS_VERSION_STRING "3.6.2" #define PROS_ERR (INT32_MAX) #define PROS_ERR_F (INFINITY) diff --git a/src/devices/vdml_imu.c b/src/devices/vdml_imu.c index 24d041593..3410efd6f 100644 --- a/src/devices/vdml_imu.c +++ b/src/devices/vdml_imu.c @@ -87,9 +87,8 @@ double imu_get_heading(uint8_t port) { claim_port_f(port - 1, E_DEVICE_IMU); ERROR_IMU_STILL_CALIBRATING(port, device, PROS_ERR_F); double rtn = vexDeviceImuDegreesGet(device->device_info) + ((imu_data_s_t*)registry_get_device(port - 1)->pad)->heading_offset; - if (rtn > IMU_HEADING_MAX) rtn -= IMU_HEADING_MAX; - if (rtn < 0) rtn += IMU_HEADING_MAX; - return_port(port - 1, rtn); + // Restricting value to raw boundaries + return_port(port - 1, fmod((rtn + IMU_HEADING_MAX), (double) IMU_HEADING_MAX)); } #define QUATERNION_ERR_INIT \ @@ -107,16 +106,9 @@ quaternion_s_t imu_get_quaternion(uint8_t port) { imu_data_s_t* data = (imu_data_s_t*)device->pad; // To calculate the quaternion values, we first get the euler values, add the offsets, // and then do the calculations. - double roll = euler.roll + data->roll_offset; - double yaw = euler.yaw + data->yaw_offset; - double pitch = euler.pitch + data->pitch_offset; - - if (roll > IMU_EULER_LIMIT) roll -= 2 * IMU_EULER_LIMIT; - if (roll < -IMU_EULER_LIMIT) roll += 2 * IMU_EULER_LIMIT; - if (yaw > IMU_EULER_LIMIT) yaw -= 2 * IMU_EULER_LIMIT; - if (yaw < -IMU_EULER_LIMIT) yaw += 2 * IMU_EULER_LIMIT; - if (pitch > IMU_EULER_LIMIT) pitch -= 2 * IMU_EULER_LIMIT; - if (pitch < -IMU_EULER_LIMIT) pitch += 2 * IMU_EULER_LIMIT; + double roll = fmod(euler.roll + data->roll_offset, 2.0 * IMU_EULER_LIMIT); + double yaw = fmod(euler.yaw + data->yaw_offset, 2.0 * IMU_EULER_LIMIT); + double pitch = fmod(euler.pitch + data->pitch_offset, 2.0 * IMU_EULER_LIMIT); double cy = cos(DEGTORAD * yaw * 0.5); double sy = sin(DEGTORAD * yaw * 0.5); @@ -148,12 +140,9 @@ euler_s_t imu_get_euler(uint8_t port) { rtn.pitch += data->pitch_offset; rtn.yaw += data->yaw_offset; rtn.roll += data->roll_offset; - if (rtn.roll > IMU_EULER_LIMIT) rtn.roll -= 2 * IMU_EULER_LIMIT; - if (rtn.roll < -IMU_EULER_LIMIT) rtn.roll += 2 * IMU_EULER_LIMIT; - if (rtn.yaw > IMU_EULER_LIMIT) rtn.yaw -= 2 * IMU_EULER_LIMIT; - if (rtn.yaw < -IMU_EULER_LIMIT) rtn.yaw += 2 * IMU_EULER_LIMIT; - if (rtn.pitch > IMU_EULER_LIMIT) rtn.pitch -= 2 * IMU_EULER_LIMIT; - if (rtn.pitch < -IMU_EULER_LIMIT) rtn.pitch += 2 * IMU_EULER_LIMIT; + rtn.roll = fmod(rtn.roll, 2.0 * IMU_EULER_LIMIT); + rtn.yaw = fmod(rtn.yaw, 2.0 * IMU_EULER_LIMIT); + rtn.pitch = fmod(rtn.pitch, 2.0 * IMU_EULER_LIMIT); return_port(port - 1, rtn); } @@ -166,9 +155,8 @@ double imu_get_pitch(uint8_t port) { v5_smart_device_s_t* device = registry_get_device(port - 1); vexDeviceImuAttitudeGet(device->device_info, (V5_DeviceImuAttitude*)&euler_values); rtn = euler_values.pitch + ((imu_data_s_t*)registry_get_device(port - 1)->pad)->pitch_offset; - if (rtn > IMU_EULER_LIMIT) rtn -= 2 * IMU_EULER_LIMIT; - if (rtn < -IMU_EULER_LIMIT) rtn += 2 * IMU_EULER_LIMIT; - return_port(port - 1, rtn); + // Restricting value to raw boundaries + return_port(port - 1, fmod(rtn, 2.0 * IMU_EULER_LIMIT)); } double imu_get_roll(uint8_t port) { @@ -180,9 +168,8 @@ double imu_get_roll(uint8_t port) { v5_smart_device_s_t* device = registry_get_device(port - 1); vexDeviceImuAttitudeGet(device->device_info, (V5_DeviceImuAttitude*)&euler_values); rtn = euler_values.roll + ((imu_data_s_t*)registry_get_device(port - 1)->pad)->roll_offset; - if (rtn > IMU_EULER_LIMIT) rtn -= 2 * IMU_EULER_LIMIT; - if (rtn < -IMU_EULER_LIMIT) rtn += 2 * IMU_EULER_LIMIT; - return_port(port - 1, rtn); + // Restricting value to raw boundaries + return_port(port - 1, fmod(rtn, 2.0 * IMU_EULER_LIMIT)); } double imu_get_yaw(uint8_t port) { @@ -194,9 +181,8 @@ double imu_get_yaw(uint8_t port) { v5_smart_device_s_t* device = registry_get_device(port - 1); vexDeviceImuAttitudeGet(device->device_info, (V5_DeviceImuAttitude*)&euler_values); rtn = euler_values.yaw + ((imu_data_s_t*)registry_get_device(port - 1)->pad)->yaw_offset; - if (rtn > IMU_EULER_LIMIT) rtn -= 2 * IMU_EULER_LIMIT; - if (rtn < -IMU_EULER_LIMIT) rtn += 2 * IMU_EULER_LIMIT; - return_port(port - 1, rtn); + // Restricting value to raw boundaries + return_port(port - 1, fmod(rtn, 2.0 * IMU_EULER_LIMIT)); } #define RAW_IMU_ERR_INIT {.x = PROS_ERR_F, .y = PROS_ERR_F, .z = PROS_ERR_F}; diff --git a/version b/version index 9575d51ba..b72762837 100644 --- a/version +++ b/version @@ -1 +1 @@ -3.6.1 +3.6.2