Skip to content

Commit 8167eb7

Browse files
Merge pull request #196 from ThomasWaldmann/bump2version
use bump2version
2 parents 340eb30 + ffb210c commit 8167eb7

File tree

5 files changed

+46
-25
lines changed

5 files changed

+46
-25
lines changed

.bumpversion.cfg

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[bumpversion]
2+
commit = True
3+
tag = True
4+
sign_tags = True
5+
tag_name = V{new_version}
6+
current_version = 1.12.1-dev
7+
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?
8+
serialize =
9+
{major}.{minor}.{patch}-{release}
10+
{major}.{minor}.{patch}
11+
12+
[bumpversion:file:multigeiger/version.h]
13+
14+
[bumpversion:file:docs/source/conf.py]
15+
16+
[bumpversion:file:docs/source/changes.rst]
17+
search = V{current_version} (not released yet)
18+
replace = V{new_version} {now:%Y-%m-%d}
19+
20+
[bumpversion:part:release]
21+
optional_value = gamma
22+
values =
23+
dev
24+
gamma

docs/source/changes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Changelog
44
=========
55

6-
V1.13.0 (not released yet)
7-
--------------------------
6+
V1.12.1-dev (not released yet)
7+
------------------
88

99
* try both adresses of BME280
1010
* LoRa payload changes, e.g. to fulfill 'TTN Fair Access Policy'

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author = 'see AUTHORS'
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = 'V1.12.0'
25+
release = 'V1.12.1-dev'
2626

2727

2828
# -- General configuration ---------------------------------------------------

multigeiger/multigeiger.ino

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,6 @@
3838
//
3939
//
4040

41-
// Release version and date
42-
// To fit in 16bit for lora version number we have some limits here:
43-
// VERSION_MAJOR = 0..15, VERSION_MINOR = 0..255, VERSION_PATCH = 0..15.
44-
#define VERSION_MAJOR 1
45-
#define VERSION_MINOR 12
46-
#define VERSION_PATCH 0
47-
// Date is in format "YYYY-MM-DD".
48-
#define VERSION_DATE "2020-01-18"
49-
5041
// Fix Parameters
5142
// Values for Serial_Print_Mode to configure Serial (USB) output mode. DON'T TOUCH!
5243
#define Serial_None 0 // No Serial output
@@ -80,6 +71,7 @@
8071

8172
// Includes
8273
//====================================================================================================================================
74+
#include "version.h"
8375
#include "userdefines.h"
8476
#include <Arduino.h>
8577
#include <U8x8lib.h>
@@ -258,7 +250,6 @@ const char *Serial_Logging_Body = "%10d %15d %10f %9f %9d %8d %9d %9f %9f";
258250
const char *Serial_One_Minute_Log_Header = "%4s %10s %29s";
259251
const char *Serial_One_Minute_Log_Body = "%4d %10d %29d";
260252
const char *Serial_Logging_Name = "Simple Multi-Geiger";
261-
char revString[25];
262253
unsigned int lora_software_version;
263254
const char *dashes = "-------------------------------------------------------------------------------------------------";
264255
int Serial_Print_Mode = SERIAL_DEBUG;
@@ -419,13 +410,12 @@ void setup() {
419410
// just for fun
420411
log(INFO, "Let's go!");
421412

422-
// build revString
423-
sprintf(revString, "V%d.%d.%d %s", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, VERSION_DATE);
424-
425413
#if SEND2LORA
426-
// build LoRa software version
427-
lora_software_version = (VERSION_MAJOR << 12) + (VERSION_MINOR << 4) + VERSION_PATCH;
414+
int major, minor, patch;
415+
sscanf(VERSION_STR, "V%d.%d.%d", &major, &minor, &patch);
416+
lora_software_version = (major << 12) + (minor << 4) + patch;
428417
#endif
418+
429419
// Check, if we have a BME280 connected:
430420
haveBME280 = bme.begin(BME280_ADDRESS);
431421
if (haveBME280 == 0) {
@@ -460,7 +450,7 @@ void setup() {
460450

461451
if (Serial_Print_Mode == Serial_Logging) {
462452
log(INFO, dashes);
463-
log(INFO, "%s, Version %s", Serial_Logging_Name, revString);
453+
log(INFO, "%s, Version %s", Serial_Logging_Name, VERSION_STR);
464454
log(INFO, dashes);
465455
log(INFO, Serial_Logging_Header,
466456
"GMC_counts", "Time_difference", "Count_Rate", "Dose_Rate", "HV Pulses", "Accu_GMC", "Accu_Time", "Accu_Rate", "Accu_Dose");
@@ -471,7 +461,7 @@ void setup() {
471461

472462
if (Serial_Print_Mode == Serial_One_Minute_Log) {
473463
log(INFO, dashes);
474-
log(INFO, "%s, Version %s", Serial_Logging_Name, revString);
464+
log(INFO, "%s, Version %s", Serial_Logging_Name, VERSION_STR);
475465
log(INFO, dashes);
476466
log(INFO, Serial_One_Minute_Log_Header,
477467
"Time", "Count_Rate", "Counts");
@@ -482,7 +472,7 @@ void setup() {
482472

483473
if (Serial_Print_Mode == Serial_Statistics_Log) {
484474
log(INFO, dashes);
485-
log(INFO, "%s, Version %s", Serial_Logging_Name, revString);
475+
log(INFO, "%s, Version %s", Serial_Logging_Name, VERSION_STR);
486476
log(INFO, dashes);
487477
log(INFO, "Time between two impacts");
488478
log(INFO, "[usec]");
@@ -762,13 +752,13 @@ void DisplayStartscreen(void) {
762752
u8x8.drawString(0, 2, "Geiger-");
763753
u8x8.drawString(0, 3, " Counter");
764754
u8x8.drawString(0, 4, "Version:");
765-
sprintf(line, "%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
755+
snprintf(line, 9, "%s", VERSION_STR); // 8 chars + \0 termination
766756
u8x8.drawString(0, 5, line);
767757
#else
768758
u8x8.setFont(u8x8_font_7x14_1x2_f);
769759
u8x8.println("Geiger-Counter");
770760
u8x8.println("==============");
771-
sprintf(line, "V%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH);
761+
snprintf(line, 15, "%s", VERSION_STR); // 14 chars + \0 termination
772762
u8x8.setCursor(7 - strlen(line) / 2, 4);
773763
u8x8.print(line);
774764
u8x8.setCursor(1, 6);
@@ -905,7 +895,7 @@ String buildhttpHeaderandBodySBM(HTTPClient *head, unsigned int hvpulses, unsign
905895
tubetype = tubetype.substring(10);
906896
String valuetype = (addname ? tubetype + "_" : "");
907897
valuetype += "counts_per_minute";
908-
String body = "{\"software_version\":\"" + String(revString) + "\",\"sensordatavalues\":[";
898+
String body = "{\"software_version\":\"" + String(VERSION_STR) + "\",\"sensordatavalues\":[";
909899
body += "{\"value_type\":\"" + valuetype + "\",\"value\":\"" + current_cpm + "\"}";
910900
body += ",{\"value_type\":\"hv_pulses\",\"value\":\"" + String(hvpulses) + "\"}";
911901
body += ",{\"value_type\":\"counts\",\"value\":\"" + String(GMC_counts_2send) + "\"}";
@@ -930,7 +920,7 @@ String buildhttpHeaderandBodyBME(HTTPClient *head, boolean addname, bool debug)
930920
humi += "humidity";
931921
String press = (addname ? "BME280_" : "");
932922
press += "pressure";
933-
String body = "{\"software_version\":\"" + String(revString) + "\",\"sensordatavalues\":[\
923+
String body = "{\"software_version\":\"" + String(VERSION_STR) + "\",\"sensordatavalues\":[\
934924
{\"value_type\":\"" + temp + "\",\"value\":\"" + String(bme_temperature, 2) + "\"},\
935925
{\"value_type\":\"" + humi + "\",\"value\":\"" + String(bme_humidity, 2) + "\"},\
936926
{\"value_type\":\"" + press + "\",\"value\":\"" + String(bme_pressure, 2) + "\"}\

multigeiger/version.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Release version
2+
// To fit in 16bit for lora version number, we have some limits here:
3+
// major = 0..15, minor = 0..255, patch = 0..15.
4+
//
5+
// vvv--- do not edit here, this is managed by bump2version! ---vvv
6+
#define VERSION_STR "V1.12.1-dev"
7+
// ^^^--- do not edit here, this is managed by bump2version! ---^^^

0 commit comments

Comments
 (0)