You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2020/12/12 12:03:01 UTC

[mynewt-core] branch master updated (0f29735 -> 72bd05d)

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


    from 0f29735  apps/ble: Use store/config instead of store/ram
     new c400a05  util/button: Defunct tick based times in syscfg
     new 72bd05d  net/ip/native_socks: Defunct tick based time in syscfg

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 hw/util/button/src/button.c             | 18 +++++++++---------
 hw/util/button/syscfg.yml               | 32 ++++++++++++++++++++++++--------
 net/ip/native_sockets/src/native_sock.c |  2 +-
 net/ip/native_sockets/syscfg.yml        |  8 ++++++--
 4 files changed, 40 insertions(+), 20 deletions(-)


[mynewt-core] 02/02: net/ip/native_socks: Defunct tick based time in syscfg

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 72bd05daf78115a79641ad073828abf77d8b08af
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Thu Dec 10 10:32:54 2020 +0100

    net/ip/native_socks: Defunct tick based time in syscfg
    
    NATIVE_SOCKETS_POLL_ITVL time interval values was using ticks as unit.
    Default value had expression involving OS_TICKS_PER_SEC that clearly
    indicated that time were meant to be expressed in real time instead of
    build specific ticks.
    
    This introduces NATIVE_SOCKETS_POLL_INTERVAL_MS equivalent syscfg value
    defined in ms, and defunct old NATIVE_SOCKETS_POLL_ITVL.
    
    Resulting code should stay the same since computation will
    be done during compilation as before.
---
 net/ip/native_sockets/src/native_sock.c | 2 +-
 net/ip/native_sockets/syscfg.yml        | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/ip/native_sockets/src/native_sock.c b/net/ip/native_sockets/src/native_sock.c
index 1c1b802..5fbf0d1 100644
--- a/net/ip/native_sockets/src/native_sock.c
+++ b/net/ip/native_sockets/src/native_sock.c
@@ -754,7 +754,7 @@ socket_task(void *arg)
     os_mutex_pend(&nss->mtx, OS_WAIT_FOREVER);
     while (1) {
         os_mutex_release(&nss->mtx);
-        os_time_delay(MYNEWT_VAL(NATIVE_SOCKETS_POLL_ITVL));
+        os_time_delay(os_time_ms_to_ticks32(MYNEWT_VAL(NATIVE_SOCKETS_POLL_INTERVAL_MS)));
         os_mutex_pend(&nss->mtx, OS_WAIT_FOREVER);
         if (nss->poll_fd_cnt) {
             rc = poll(nss->poll_fds, nss->poll_fd_cnt, 0);
diff --git a/net/ip/native_sockets/syscfg.yml b/net/ip/native_sockets/syscfg.yml
index aceb333..df82b59 100644
--- a/net/ip/native_sockets/syscfg.yml
+++ b/net/ip/native_sockets/syscfg.yml
@@ -24,10 +24,14 @@ syscfg.defs:
         description: 'The maximum UDP datagram size (send and receive).'
         value: 2048
     NATIVE_SOCKETS_POLL_ITVL:
+        description: Use NATIVE_SOCKETS_POLL_INTERVAL instead.
+        defunct: 1
+        value:
+    NATIVE_SOCKETS_POLL_INTERVAL_MS:
         description: >
             The frequency at which to poll for received data.  Units
-            are OS ticks.
-        value: 'OS_TICKS_PER_SEC / 5'
+            are ms.
+        value: 200
     NATIVE_SOCKETS_STACK_SZ:
         description: 'The size of the native sockets task stack, in bytes.'
         value: 4096


[mynewt-core] 01/02: util/button: Defunct tick based times in syscfg

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit c400a05b07ff9158e2aaede4f47341613e9bca7d
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Thu Dec 10 10:11:02 2020 +0100

    util/button: Defunct tick based times in syscfg
    
    Several time interval values were using ticks as units.
    Default values for those were defined with expressions
    involving OS_TICKS_PER_SEC that clearly indicated that
    times were meant to be expressed in real time instead of
    build specific ticks.
    
    This introduces button time syscfg values defined in ms,
    and defunct old tick-based value.
    
    Resulting code should stay the same since computation will
    be done during compilation as before.
---
 hw/util/button/src/button.c | 18 +++++++++---------
 hw/util/button/syscfg.yml   | 32 ++++++++++++++++++++++++--------
 2 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/hw/util/button/src/button.c b/hw/util/button/src/button.c
index 2744b1c..005afb3 100644
--- a/hw/util/button/src/button.c
+++ b/hw/util/button/src/button.c
@@ -370,14 +370,14 @@ button_exec_fsm(button_t *button, int action)
  do_pressed:
 #if MYNEWT_VAL(BUTTON_USE_LONG)
     if (button->mode & BUTTON_FLG_LONG) {
-        os_callout_reset(callout, MYNEWT_VAL(BUTTON_LONGHOLD_TICKS));
+        os_callout_reset(callout, os_time_ms_to_ticks32(MYNEWT_VAL(BUTTON_LONGHOLD_TIME_MS)));
 #if MYNEWT_VAL(BUTTON_USE_REPEAT)
     } else if (button->mode & BUTTON_FLG_REPEATING) {
-        os_callout_reset(callout, MYNEWT_VAL(BUTTON_REPEAT_FIRST_TICKS));
+        os_callout_reset(callout, os_time_ms_to_ticks32(MYNEWT_VAL(BUTTON_REPEAT_FIRST_TIME_MS)));
 #endif
     }
 #elif MYNEWT_VAL(BUTTON_USE_REPEAT)
-    os_callout_reset(callout, MYNEWT_VAL(BUTTON_REPEAT_FIRST_TICKS));
+    os_callout_reset(callout, os_time_ms_to_ticks32(MYNEWT_VAL(BUTTON_REPEAT_FIRST_TIME_MS)));
 #endif
     button->state = BUTTON_FLG_PRESSED;
 #if MYNEWT_VAL(BUTTON_EMIT_STATE_CHANGED)
@@ -391,23 +391,23 @@ button_exec_fsm(button_t *button, int action)
     
 #if MYNEWT_VAL(BUTTON_USE_DOUBLE)
  to_wait_dblpressed:
-    os_callout_reset(callout, MYNEWT_VAL(BUTTON_DBLCLICK_TICKS));
+    os_callout_reset(callout, os_time_ms_to_ticks32(MYNEWT_VAL(BUTTON_DBLCLICK_TIMEOUT_MS)));
     button->fsm_state = _BUTTON_FSM_WAIT_DBLPRESSED;
     return;
     
  do_dblpressed:
 #if MYNEWT_VAL(BUTTON_USE_LONG)
     if (button->mode & BUTTON_FLG_LONG) {
-        os_callout_reset(callout, MYNEWT_VAL(BUTTON_LONGHOLD_TICKS));
+        os_callout_reset(callout, os_time_ms_to_ticks32(MYNEWT_VAL(BUTTON_LONGHOLD_TIME_MS)));
 #if MYNEWT_VAL(BUTTON_USE_REPEAT)
     } else if (button->mode & BUTTON_FLG_REPEATING) {
-        os_callout_reset(callout, MYNEWT_VAL(BUTTON_REPEAT_FIRST_TICKS)); 
+        os_callout_reset(callout, os_time_ms_to_ticks32(MYNEWT_VAL(BUTTON_REPEAT_FIRST_TIME_MS)));
 #endif
     } else {
         os_callout_stop(callout);
     }   
 #elif MYNEWT_VAL(BUTTON_USE_REPEAT)
-    os_callout_reset(callout, MYNEWT_VAL(BUTTON_REPEAT_FIRST_TICKS)); 
+    os_callout_reset(callout, os_time_ms_to_ticks32(MYNEWT_VAL(BUTTON_REPEAT_FIRST_TIME_MS)));
 #else
     os_callout_stop(callout);
 #endif
@@ -423,7 +423,7 @@ button_exec_fsm(button_t *button, int action)
  do_longpress:
 #if MYNEWT_VAL(BUTTON_USE_REPEAT)
     if (button->mode & BUTTON_FLG_REPEATING)
-        os_callout_reset(callout, MYNEWT_VAL(BUTTON_REPEAT_FIRST_TICKS));
+        os_callout_reset(callout, os_time_ms_to_ticks32(MYNEWT_VAL(BUTTON_REPEAT_FIRST_TIME_MS)));
 #endif
     button->state |= BUTTON_FLG_LONG;
 #if MYNEWT_VAL(BUTTON_EMIT_STATE_CHANGED)
@@ -435,7 +435,7 @@ button_exec_fsm(button_t *button, int action)
     
 #if MYNEWT_VAL(BUTTON_USE_REPEAT)
  do_repeat:
-    os_callout_reset(callout, MYNEWT_VAL(BUTTON_REPEAT_TICKS));
+    os_callout_reset(callout, os_time_ms_to_ticks32(MYNEWT_VAL(BUTTON_REPEAT_TIME_MS)));
     
 #if MYNEWT_VAL(BUTTON_EMIT_ACTION)
 #if MYNEWT_VAL(BUTTON_USE_EMULATION)
diff --git a/hw/util/button/syscfg.yml b/hw/util/button/syscfg.yml
index 5e0f4ca..e523300 100644
--- a/hw/util/button/syscfg.yml
+++ b/hw/util/button/syscfg.yml
@@ -19,24 +19,40 @@
 
 syscfg.defs:
     BUTTON_DBLCLICK_TICKS:
+        description: Use BUTTON_DBLCLICK_TIMEOUT_MS instead.
+        defunct: 1
+        value:
+    BUTTON_LONGHOLD_TICKS:
+        description: Use BUTTON_LONGHOLD_TIME_MS instead.
+        defunct: 1
+        value:
+    BUTTON_REPEAT_FIRST_TICKS:
+        description: Use BUTTON_REPEAT_FIRST_TIME_MS instead.
+        defunct: 1
+        value:
+    BUTTON_REPEAT_TICKS:
+        description: Use BUTTON_REPEAT_TIME_MS instead.
+        defunct: 1
+        value:
+    BUTTON_DBLCLICK_TIMEOUT_MS:
         description: >
-            Maximum time in wich a second click should be performed
+            Maximum time in which a second click should be performed
             to consider it a double click. This will also introduce
             a delay for generating the single click event.
-        value: '(OS_TICKS_PER_SEC / 4)'
-    BUTTON_LONGHOLD_TICKS:
+        value: 250
+    BUTTON_LONGHOLD_TIME_MS:
         description: >
             Minimum time to wait with the button pressed to consider
             it a long hold (long press, long click, long double click).
-        value: '(OS_TICKS_PER_SEC)'
-    BUTTON_REPEAT_FIRST_TICKS:
+        value: 1000
+    BUTTON_REPEAT_FIRST_TIME_MS:
         description: >
             Time to wait before generating the first repeated action.
-        value: '(OS_TICKS_PER_SEC)'
-    BUTTON_REPEAT_TICKS:
+        value: 1000
+    BUTTON_REPEAT_TIME_MS:
         description: >
             Time to wait before generating consecutive repeated action.
-        value: '(OS_TICKS_PER_SEC)'
+        value: 1000
     BUTTON_EVENT_MAX:
         description: >
             Maximum number of pending button event. (about 20bytes/event)