Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Macro from min to MIN in lpn.c #1709

Open
David-Mudrich opened this issue Feb 22, 2024 · 0 comments
Open

Change Macro from min to MIN in lpn.c #1709

David-Mudrich opened this issue Feb 22, 2024 · 0 comments

Comments

@David-Mudrich
Copy link

Hi,
I am using Nimble in ESP-IDF from a C project and GCC complains about undefined function min() (small letters).
MIN() (big letters) is used also in this file and works with C projects as it is defined in indirectly included mesh/glue.h (via mesh/mesh.h).
Please change other occurrences from min to MIN.

---8<---

--- lpn_orig.c 2024-02-14 21:01:16.662505000 +0100
+++ lpn.c 2024-02-22 20:05:41.852456394 +0100
@@ -32,7 +32,7 @@
#endif

#define LPN_RECV_DELAY MYNEWT_VAL(BLE_MESH_LPN_RECV_DELAY)
-#define SCAN_LATENCY min(MYNEWT_VAL(BLE_MESH_LPN_SCAN_LATENCY),
+#define SCAN_LATENCY MIN(MYNEWT_VAL(BLE_MESH_LPN_SCAN_LATENCY),
LPN_RECV_DELAY)

#define FRIEND_REQ_RETRY_TIMEOUT K_SECONDS(MYNEWT_VAL(BLE_MESH_LPN_RETRY_TIMEOUT))
@@ -152,12 +152,12 @@
{
/* If we're waiting for segment acks keep polling at high freq */
if (bt_mesh_tx_in_progress()) {

  •   return min(POLL_TIMEOUT_MAX(lpn), K_SECONDS(1));
    
  •   return MIN(POLL_TIMEOUT_MAX(lpn), K_SECONDS(1));
    

    }

    if (lpn->poll_timeout < POLL_TIMEOUT_MAX(lpn)) {
    lpn->poll_timeout *= 2;

  •   lpn->poll_timeout = min(lpn->poll_timeout,
    
  •   lpn->poll_timeout = MIN(lpn->poll_timeout,
      			POLL_TIMEOUT_MAX(lpn));
    
    }

@@ -1000,7 +1000,7 @@
}

	/* Set initial poll timeout */
  •   lpn->poll_timeout = min(POLL_TIMEOUT_MAX(lpn),
    
  •   lpn->poll_timeout = MIN(POLL_TIMEOUT_MAX(lpn),
      			POLL_TIMEOUT_INIT);
    
    }

--->8---

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant