]> rtime.felk.cvut.cz Git - pes-rpp/rpp-simulink.git/commitdiff
Update canreceive block to a change in CAN API
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sat, 13 Sep 2014 11:34:02 +0000 (13:34 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sat, 13 Sep 2014 11:34:02 +0000 (13:34 +0200)
Possible return values of rpp_can_read() have been changed.

Refs #971

rpp/blocks/tlc_c/sfunction_canreceive.tlc
rpp/lib

index 2e66971ca5f93a98a33e8f8eb35fc7570959b472..ef4febd3f390405b6ef483b3e6e78dab781a928e 100644 (file)
 
        {
          struct rpp_can_pdu pdu;
-
-         if (rpp_can_read(%<RppRxInfo.HwObj>, &pdu) != SUCCESS) {
-               // TODO:        Implement some intelligent way how to detect that message receiving has failed
-               //                      Now there is no way how to recognize failure and the case thet no message has been received.
-               //rpp_sci_printf("Receiving CAN message failed (%s).\n", RppRxInfo.Name);
-         } else {
+         int ret;
+
+         ret = rpp_can_read(%<RppRxInfo.HwObj>, &pdu);
+         switch (ret) {
+           case -RPP_EINVAL:
+               rpp_sci_printf("Receiving CAN message failed (%s).\n", "%<RppRxInfo.Name>");
+               break;
+           case -RPP_ENODATA:
+               break;
+           case SUCCESS: {
                %if %<data_type_par>==4
                  // CAN_MESSAGE
                  %<message>.Length = pdu.dlc;
                  %% call the downstream system
                  %<LibBlockExecuteFcnCall(block, callIdx)>\
                %endforeach
+               break;
+           }
          }
        }
   %endif
diff --git a/rpp/lib b/rpp/lib
index aba445733f7c6691616d48a03317991d659ede9d..3e5ad02990d385cc6b5d4ef66eee0949e944f81d 160000 (submodule)
--- a/rpp/lib
+++ b/rpp/lib
@@ -1 +1 @@
-Subproject commit aba445733f7c6691616d48a03317991d659ede9d
+Subproject commit 3e5ad02990d385cc6b5d4ef66eee0949e944f81d