Skip to content

Conversation

@lucasnot
Copy link
Collaborator

@lucasnot lucasnot commented Apr 4, 2017

New pull request because I deleted the new one

Preliminary to making the sensors function
Changed the loop in dht11.c so that it does not run infinitly, instead,
ends when the two values are read in
Formatting and what not
Fixed a few things detailed in the pull request review
@lucasnot lucasnot requested a review from djpetti April 4, 2017 19:58
Copy link
Owner

@djpetti djpetti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you already have all my comments, Lucas.

@djpetti djpetti added this to the Get all the sensors working. milestone Apr 18, 2017
@djpetti djpetti closed this Sep 8, 2017
@djpetti djpetti changed the base branch from psoc to devel September 8, 2017 02:07
@djpetti
Copy link
Owner

djpetti commented Sep 8, 2017

This got closed when I deleted the psoc branch. All that code is in the devel branch now, so I've changed the base, and am reopening this. Incidentally, it will probably also have to be rebased.

@djpetti djpetti reopened this Sep 8, 2017
Put the loop that reads in the temperature and humidity in a switch
case. This was its not running awlays, and won't run unless we initilize
it again.
Copy link
Owner

@djpetti djpetti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interrupt-driven stuff is moving in the right direction.

Also, you need to rebase this on devel before it can get merged.

_CY_ISR_PROTO(Delay_Timer_ISR_Handler);
_CY_ISR_PROTO(DHT_Pin_ISR_Handler);

// What Return_Decoded_Temperature does:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update function name in comment.


if(g_decoded_temperature_data == NULL) {
return -1;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put else on same line as closing brace.

}
}

// What Return_Decoded_Humidity does:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update function name in comment.


uint8_t dht_get_temperature(){

if(g_decoded_temperature_data == NULL) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a space between "if" and "(". Same for "else" and "{".

g_executed = 0;
Delay_Timer_ISR_Enable();
// Write 0 to Control_Reg_Delay_Timer to starting Delay_Timer component
Control_Reg_Delay_Timer_Write(0);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure there's not just a Delay_Timer_Start() function you can call?

}

int j;
for(j=0; j<8; ++j) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces around "=" and "<" again. Also, it looks like there are some more "magic" numbers here that need documentation.

DHT_Pin_ClearInterrupt();
// Read the counter values of Data_Timer for processing
g_countvalues_datatimer[g_risingedge_counts]=Data_Timer_ReadCounter();
g_risingedge_counts++;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer preincrement when you can. It's more efficient.

// Clear the interrupt request of the pin DHT_Pin
DHT_Pin_ClearInterrupt();
// Read the counter values of Data_Timer for processing
g_countvalues_datatimer[g_risingedge_counts]=Data_Timer_ReadCounter();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space around "=".

// be in the respective variables

/*
switch(g_has_been_executed){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything below here looks like the old blocking implementation. Did you mean to get rid of it?

#include <stdint.h>


//Initilize everything needed
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after //

This change makes it so that instead of the temp and humidity sensor
being continually updated, it doesnt update until someone calls it agian
I guess this didn't go with the previous commit
Just changing things to be more pleasing to look at and easier to read.
This change is for increased functionality and also a sense of
cleanliness in the code
Not needed when the functions are called properly
We don't need it any more, since we took away the switch statment
@djpetti
Copy link
Owner

djpetti commented Dec 2, 2017

Have you tested this on actual hardware yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants