diff --git a/.gitignore b/.gitignore
index 0cc6dfc..f116a11 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-.idea
.vscode
build
cmake-build-debug
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/RP2040-Decoder.iml b/.idea/RP2040-Decoder.iml
new file mode 100644
index 0000000..f08604b
--- /dev/null
+++ b/.idea/RP2040-Decoder.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..79b3c94
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..7baa790
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..2532000
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8f08180..50d798f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,9 @@ set(CMAKE_CXX_STANDARD 17)
set(PICO_DECODER_PATH ${PROJECT_SOURCE_DIR})
+# Stop the compiler from inling method calls making it easier to debug
+set(PICO_DEOPTIMIZED_DEBUG 1)
+
# Initialize the SDK
pico_sdk_init()
diff --git a/core0.c b/core0.c
index fb8f0d7..a46b953 100644
--- a/core0.c
+++ b/core0.c
@@ -242,7 +242,8 @@ void set_outputs(uint32_t functions_to_set_bitmask) {
uint32_t temp_mask = 1;
for (uint8_t i = 0; i < 32; i++) {
if (temp_mask & functions_to_set_bitmask ){
- outputs_to_set |= get_32bit_CV(i * 8 + 260 - 4 * get_direction(0));
+ bool dir = get_direction(0);
+ outputs_to_set |= get_32bit_CV(i * 8 + 260 - 4 * dir);
}
temp_mask<<=1;
}
@@ -384,7 +385,7 @@ void instruction_evaluation(uint8_t number_of_bytes,const uint8_t * const byte_a
update_active_functions((command_byte_n << 9),2,false);
break;
default: // F0-F4
- update_active_functions(((command_byte_n << 1) + (command_byte_n >> 4)),0,false);
+ update_active_functions((((command_byte_n & 0b00001111) << 1) + ((command_byte_n & 0b00010000) >> 4)),0,false);
break;
}
}
@@ -624,8 +625,13 @@ bool get_direction(bool *direction_ptr){
static bool set_flag;
static bool *dir_ptr;
if(!set_flag) {
- dir_ptr = direction_ptr;
- set_flag = true;
+ if (direction_ptr == NULL){
+ LOG(0, "Error! Direction pointer argument is NULL-pointer!")
+ }
+ else {
+ set_flag = true;
+ dir_ptr = direction_ptr;
+ }
}
return *dir_ptr;
}