Skip to content

Commit 2c38d10

Browse files
committed
Convert to Ardino IDE structure
1 parent fe0a985 commit 2c38d10

File tree

13 files changed

+68
-22
lines changed

13 files changed

+68
-22
lines changed

lib/ads1231/ads1231.cpp renamed to ads1231.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
#include <Arduino.h>
1818
#include <limits.h>
1919

20-
#include <ads1231.h>
21-
#include <custom_eeprom.h>
22-
#include <utils.h>
23-
#include "../../config.h"
24-
#include <errors.h>
20+
#include "ads1231.h"
21+
#include "custom_eeprom.h"
22+
#include "utils.h"
23+
#include "config.h"
24+
#include "errors.h"
2525

2626
unsigned long ads1231_last_millis = 0;
2727
int ads1231_offset = 0;

lib/ads1231/ads1231.h renamed to ads1231.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#ifndef ADS1231_H
66
#define ADS1231_H
77

8-
#include <errors.h>
8+
#include "errors.h"
99

1010
extern unsigned long ads1231_last_millis;
1111
extern int ads1231_offset;

src/sketch.ino renamed to barwin-arduino.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
*/
2020

2121
#include <Arduino.h>
22-
#include <ads1231.h>
23-
#include <bottle.h>
24-
#include <utils.h>
25-
#include <errors.h>
22+
#include "ads1231.h"
23+
#include "bottle.h"
24+
#include "utils.h"
25+
#include "errors.h"
2626
#include "config.h"
2727

2828

lib/bottle/bottle.cpp renamed to bottle.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
*/
44

55
#include <Arduino.h>
6-
#include <bottle.h>
7-
#include <ads1231.h>
8-
#include <utils.h>
9-
#include <errors.h>
10-
#include "../../config.h"
6+
7+
#include "bottle.h"
8+
#include "ads1231.h"
9+
#include "utils.h"
10+
#include "errors.h"
11+
#include "config.h"
1112

1213

1314
/*

bottle.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* Bottle class.
3+
*/
4+
5+
#ifndef BOTTLE_H
6+
#define BOTTLE_H
7+
8+
// 'pos' should be always between following two constants, when calling
9+
// Bottle::turn_to(pos, delay_ms). Edit this values according to used servos.
10+
// The constants might be used to initialize pos_down and pos_up (in config.h).
11+
// See also:
12+
// http://arduino.cc/en/Reference/ServoWriteMicroseconds
13+
#define SERVO_MIN 500
14+
#define SERVO_MAX 2500
15+
16+
#include <Servo.h>
17+
#include "errors.h"
18+
19+
// Macro initialising a array 'bottles' of Bottle instances as defined
20+
// in config.h by the comma separated list BOTTLES of constructor calls:
21+
#define DEFINE_BOTTLES() Bottle bottles[] = {BOTTLES};\
22+
char bottles_nr = sizeof(bottles)/sizeof(bottles[0]);
23+
24+
25+
26+
class Bottle {
27+
public:
28+
Bottle(unsigned char, unsigned char, int, int);
29+
static void init(Bottle* bottles, int bottles_nr);
30+
errv_t turn_to(int pos, int delay_ms, bool check_weight=false, int* stable_weight=NULL, bool enable_abortcheck=true);
31+
errv_t turn_up(int delay_ms, bool enable_abortcheck=true);
32+
errv_t turn_down(int delay_ms, bool check_weight=false);
33+
int get_pause_pos();
34+
errv_t turn_to_pause_pos(int delay_ms);
35+
errv_t pour(int requested_amount, int& measured_amount);
36+
Servo servo; // servo used for turning the bottle
37+
const unsigned char number; // all bottles have a unique number (0-n)
38+
const unsigned char pin; // pin to attach the servo
39+
const int pos_down; // servo position for bottle down (pouring)
40+
const int pos_up; // servo position for bottle up (not pouring)
41+
};
42+
43+
#endif
44+
File renamed without changes.
File renamed without changes.

lib/errors/errors.cpp renamed to errors.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <Arduino.h>
2+
23
#include "errors.h"
34

45
/**
File renamed without changes.

lib/bottle/bottle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define SERVO_MAX 2500
1515

1616
#include <Servo.h>
17-
#include <errors.h>
17+
#include "errors.h"
1818

1919
// Macro initialising a array 'bottles' of Bottle instances as defined
2020
// in config.h by the comma separated list BOTTLES of constructor calls:

0 commit comments

Comments
 (0)