<commit_before>//
//  mesh.h
//  Mesh
//
//  Created by tim on 1/8/15.
//  Copyright (c) 2015 tim. All rights reserved.
//

#ifndef Mesh_mesh_h
#define Mesh_mesh_h

//
// Total RAM usage is defined as follow:
//
// 49 + 4 * ceil(MESH_MAX_NEIGHBORS / 8) + (MESH_MAX_NODES * 7) + (MESH_MAX_NEIGHBORS * 6) +
//   (MESH_MAX_VALUES * (5 + MESH_DEFAULT_VALUE_SIZE + ceil(MESH_MAX_NEIGHBORS / 8)))
//

//
// Include local overrides.
//
#include "mesh-local.h"

//
// The maximum number of nodes supported in the mesh.
//
#if !defined(MESH_MAX_NODES)
#define MESH_MAX_NODES                16
#endif

//
// The maximum number of neighbors (directly accessible nodes) supported by each node.
// NOTE: sizeof(Mesh_ChangeBits) * 8 >= MESH_MAX_NEIGHBOR
//
#if !defined(MESH_MAX_NEIGHBORS)
#define MESH_MAX_NEIGHBORS             8
#endif

//
// The maximum number of values supported by each node.
//
#if !defined(MESH_MAX_VALUES)
#define MESH_MAX_VALUES                (MESH_MAX_NODES * 8)
#endif

//
// Enable mesh trimming.
// Trimming allows for more unique values in the network than defined by MESH_MAX_VALUES.
// Each node will see every value, but will only cache the most recent changes.
//
#if !defined(ENABLE_MESH_TRIMMING)
#define ENABLE_MESH_TRIMMING           0
#endif

//
// The default, preallocate space for each value.
// If a value doesn't fit into this size and malloc is available, it is used to allocate a large space.
//
#if !defined(MESH_DEFAULT_VALUE_SIZE)
#define MESH_DEFAULT_VALUE_SIZE       (sizeof(unsigned char*))
#endif

//
// The maximum value size a value can be.
//
#if !defined(MESH_MAX_VALUE_SIZE)
#define MESH_MAX_VALUE_SIZE           64
#endif

//
// Enable mesh malloc.
// Without malloc, mesh values are restricted to a maximum size of MESH_DEFAULT_VALUE_SIZE bytes.
//
#if !defined(ENABLE_MESH_MALLOC)
#define ENABLE_MESH_MALLOC             1
#endif

//
// The UUID used for the base of all mesh related advertising, services and characteristics.
//
#if !defined(MESH_SERVICE_BASE_UUID)
#define MESH_SERVICE_BASE_UUID        0x1D, 0xAE, 0x74, 0x7C, 0x62, 0xA9, 0x95, 0x9C, 0x9A, 0x44, 0xBD, 0x5F, (0), (0), 0xAD, 0x79
#endif

//
// Limit the number of neighbor nodes to allow space for new nodes to join.
//
#define MESH_NEIGHBOR_LIMIT           (MESH_MAX_NEIGHBORS - 4)

//
// Limit the number of retries when connecting to a neighbor. After enough failures a neighbor is forgotten.
//
#define	MESH_MAX_RETRIES              16

//
// Limit the number of retries when connecting to clients (phones). Clients may be legitimately absent for a long time.
//
#define MESH_MAX_CLIENT_RETRIES       4

//
// Only tell neighbors about our other neighbors if they are reliable (have few retries).
//
#define MESH_NEIGHBOR_FORWARD_LIMIT   (MESH_MAX_RETRIES / 4)

//
// Nodes periodically send keepalive messages. If nodes messages aren't seen after 2 sweeps the node
// will be forgotten (assumed removed or failed).
//
#if !defined(MESH_KEEPALIVE_TIME)
#define MESH_KEEPALIVE_TIME           (15 * 60)                     // 15 minutes
#endif
#define MESH_KEEPALIVE_SWEEP_TIME     (2 * MESH_KEEPALIVE_TIME)     // 30 minutes

//
// Advertising
//
#if !defined(MESH_ADVERTISING_PERIOD)
#define MESH_ADVERTISING_PERIOD       1000
#endif
#if !defined(MESH_ADVERTISING_FAST_PERIOD)
#define MESH_ADVERTISING_FAST_PERIOD  100
#endif
#if !defined(MESH_ADVERTISING_TXPOWER)
#define MESH_ADVERTISING_TXPOWER      0xCA
#endif

//
// Standard BLE sizes
//
#define MESH_NODEADDRESS_SIZE          6  // MAC address
#define MESH_MAX_WRITE_SIZE           20
#define MESH_MAX_READ_SIZE            20

#define MESH_BUFFER_SIZE              (MESH_MAX_WRITE_SIZE > MESH_MAX_READ_SIZE ? MESH_MAX_WRITE_SIZE : MESH_MAX_READ_SIZE)

<commit_msg>Increase sweep time<commit_after>//
//  mesh.h
//  Mesh
//
//  Created by tim on 1/8/15.
//  Copyright (c) 2015 tim. All rights reserved.
//

#ifndef Mesh_mesh_h
#define Mesh_mesh_h

//
// Total RAM usage is defined as follow:
//
// 49 + 4 * ceil(MESH_MAX_NEIGHBORS / 8) + (MESH_MAX_NODES * 7) + (MESH_MAX_NEIGHBORS * 6) +
//   (MESH_MAX_VALUES * (5 + MESH_DEFAULT_VALUE_SIZE + ceil(MESH_MAX_NEIGHBORS / 8)))
//

//
// Include local overrides.
//
#include "mesh-local.h"

//
// The maximum number of nodes supported in the mesh.
//
#if !defined(MESH_MAX_NODES)
#define MESH_MAX_NODES                16
#endif

//
// The maximum number of neighbors (directly accessible nodes) supported by each node.
// NOTE: sizeof(Mesh_ChangeBits) * 8 >= MESH_MAX_NEIGHBOR
//
#if !defined(MESH_MAX_NEIGHBORS)
#define MESH_MAX_NEIGHBORS             8
#endif

//
// The maximum number of values supported by each node.
//
#if !defined(MESH_MAX_VALUES)
#define MESH_MAX_VALUES                (MESH_MAX_NODES * 8)
#endif

//
// Enable mesh trimming.
// Trimming allows for more unique values in the network than defined by MESH_MAX_VALUES.
// Each node will see every value, but will only cache the most recent changes.
//
#if !defined(ENABLE_MESH_TRIMMING)
#define ENABLE_MESH_TRIMMING           0
#endif

//
// The default, preallocate space for each value.
// If a value doesn't fit into this size and malloc is available, it is used to allocate a large space.
//
#if !defined(MESH_DEFAULT_VALUE_SIZE)
#define MESH_DEFAULT_VALUE_SIZE       (sizeof(unsigned char*))
#endif

//
// The maximum value size a value can be.
//
#if !defined(MESH_MAX_VALUE_SIZE)
#define MESH_MAX_VALUE_SIZE           64
#endif

//
// Enable mesh malloc.
// Without malloc, mesh values are restricted to a maximum size of MESH_DEFAULT_VALUE_SIZE bytes.
//
#if !defined(ENABLE_MESH_MALLOC)
#define ENABLE_MESH_MALLOC             1
#endif

//
// The UUID used for the base of all mesh related advertising, services and characteristics.
//
#if !defined(MESH_SERVICE_BASE_UUID)
#define MESH_SERVICE_BASE_UUID        0x1D, 0xAE, 0x74, 0x7C, 0x62, 0xA9, 0x95, 0x9C, 0x9A, 0x44, 0xBD, 0x5F, (0), (0), 0xAD, 0x79
#endif

//
// Limit the number of neighbor nodes to allow space for new nodes to join.
//
#define MESH_NEIGHBOR_LIMIT           (MESH_MAX_NEIGHBORS - 4)

//
// Limit the number of retries when connecting to a neighbor. After enough failures a neighbor is forgotten.
//
#define	MESH_MAX_RETRIES              16

//
// Limit the number of retries when connecting to clients (phones). Clients may be legitimately absent for a long time.
//
#define MESH_MAX_CLIENT_RETRIES       4

//
// Only tell neighbors about our other neighbors if they are reliable (have few retries).
//
#define MESH_NEIGHBOR_FORWARD_LIMIT   (MESH_MAX_RETRIES / 4)

//
// Nodes periodically send keepalive messages. If nodes messages aren't seen after 2 sweeps the node
// will be forgotten (assumed removed or failed).
//
#if !defined(MESH_KEEPALIVE_TIME)
#define MESH_KEEPALIVE_TIME           (15 * 60)                     // 15 minutes
#endif
#define MESH_KEEPALIVE_SWEEP_TIME     (4 * MESH_KEEPALIVE_TIME)     // 60 minutes

//
// Advertising
//
#if !defined(MESH_ADVERTISING_PERIOD)
#define MESH_ADVERTISING_PERIOD       1000
#endif
#if !defined(MESH_ADVERTISING_FAST_PERIOD)
#define MESH_ADVERTISING_FAST_PERIOD  100
#endif
#if !defined(MESH_ADVERTISING_TXPOWER)
#define MESH_ADVERTISING_TXPOWER      0xCA
#endif

//
// Standard BLE sizes
//
#define MESH_NODEADDRESS_SIZE          6  // MAC address
#define MESH_MAX_WRITE_SIZE           20
#define MESH_MAX_READ_SIZE            20

#define MESH_BUFFER_SIZE              (MESH_MAX_WRITE_SIZE > MESH_MAX_READ_SIZE ? MESH_MAX_WRITE_SIZE : MESH_MAX_READ_SIZE)


{'fraction_non_alphanumeric': 0.09348290598290598, 'fraction_numerical': 0.022702991452991452, 'mean_word_length': 3.181462869905081, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6683642', 'n_tokens_mistral': 2797, 'n_tokens_neox': 2626, 'n_words': 786}